Project

General

Profile

Bug #11515

Patching NCURSES Using Static Linking on Ubuntu 24.04.4 LTS (Noble Numbat)

Added by Ovidiu Maxiniuc about 2 months ago. Updated 26 days ago.

Status:
Review
Priority:
Normal
Target version:
-
Start date:
Due date:
% Done:

100%

billable:
No
vendor_id:
GCD
case_num:
version_reported:
version_resolved:
production:
No
env_name:
topics:

setup_ncurses6_4-noWide.sh Magnifier - patching script (5.71 KB) Ovidiu Maxiniuc, 06/04/2026 05:13 PM

libncurses_curses_h_in_v6.4+20240113.patch Magnifier - patch for curses.h.in (536 Bytes) Ovidiu Maxiniuc, 06/04/2026 05:15 PM

libncurses_lib_getch_c_v6.4+20240113.patch Magnifier - patch for lib_getch.c (1005 Bytes) Ovidiu Maxiniuc, 06/04/2026 05:15 PM

setup_ncurses6_4-noWide.sh Magnifier (6.79 KB) Ovidiu Maxiniuc, 06/08/2026 03:37 PM

setup_ncurses6_4-noWide.sh Magnifier (6.84 KB) Roger Borrello, 06/12/2026 12:13 PM

setup_ncurses6_4-noWide.sh Magnifier (8.35 KB) Roger Borrello, 06/15/2026 12:44 PM

setup_ncurses6x.sh Magnifier (9.26 KB) Roger Borrello, 06/25/2026 01:50 PM


Related issues

Related to User Interface - Support #2660: evaluate if the NCURSES 5.7 "threading improvements" can be made to work for P2J such that auto_getch_refresh() is no longer needed Test

History

#1 Updated by Ovidiu Maxiniuc about 2 months ago

The current wiki at NCURSES is currently deprecated, as it describes the process of patching for ncurses 6.1. For Ubuntu 24.04.4 LTS some adjustments are required, as described below.

  • Download the attached three files and save to a new public location on your system;
  • Use chmod +x to set the execute permission for setup_ncurses6_4-noWide.sh;
  • Launch ./setup_ncurses6_4-noWide.sh -fs.
    • the -f parameter will cause the ncurses library to be patched (which will exclude PTHREADS multi-threaded support);
    • the -s parameter will make sure to update system-wide environment (using /etc/profile.d/10-ncurses.sh) instead of just current user (using ~/.bashrc);
  • Reboot/re-login so that the above changes take effect. To test whether the environment was updated use export | grep -i fwd. The output should be a single line like:
    declare -x NCURSES_FWD_STATIC="/<public-path-to>/ncurses-6.4+20240113"
    No such line or a different path means the process was not finished with success.
    The presence of a second line
    declare -x NCURSES_FWD_PTHREADS="true"
    means the thread-safe (NOT patched) NCURSES libraries are active.
  • Go to your FWD project and rebuild the native library using ./gradlew clean native
  • Testing the output:
    • use ldd build/lib/libp2j.so in the root of FWD. The output should look like:
      linux-vdso.so.1 (0x00007ffc6b6bd000)
      libffi.so.8 => /lib/x86_64-linux-gnu/libffi.so.8 (0x0000729d785d4000)
      libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x0000729d78200000)
      /lib64/ld-linux-x86-64.so.2 (0x0000729d7864f000)
      The absence of libncurses.so.6 means the library is, indeed, statically linked;
    • use nm -g build/lib/libp2j.so | grep -Ew '[0-9A-Fa-f]+ +T +auto_getch_refresh' to confirm the native library does indeed contain the patched version. The absence of a line like:
      000000000001ea20 T auto_getch_refresh
      means that your binaries was not built against the patched version of ncurses.

The attached resources were taken from the above-mentioned wiki and they were updated to match ncurses v6.4+20240113 currently available on said OS version.

Note:
Intentionally, I have not yet updated the NCURSES page because it already contain three subpages for patching/using the library in different scenarios. I think that page should be reorganised a bit, to include the OS version they address. Also, the Ubuntu 26.04 LTS (Resolute Raccoon) was released on April 23, 2026 (with Linux kernel 7.0.0 I understand) and we might need an update for that one as well, as soon as we will start to roll it on our workstations.

#2 Updated by Roger Borrello about 1 month ago

Ovidiu, are you utilizing the ncurses process setup in both gcd_systems and FWD trunk? They are the baseline, and can be found in:
  • FWD: ./tools/scripts/setup_ncurses6x.sh
  • gcd_systems: ./roles/ncurses/files/setup_ncurses6x.sh

#6 Updated by Ovidiu Maxiniuc about 1 month ago

It looks like my Ubuntu uses ncurses-6.4+20240113. Both scripts above attempt to patch v6.1_20200708 and fail, because of the code mismatches.

I did one more search and linked the most related tasks on similar topics.

#7 Updated by Roger Borrello about 1 month ago

Ovidiu Maxiniuc wrote:

It looks like my Ubuntu uses ncurses-6.4+20240113. Both scripts above attempt to patch v6.1_20200708 and fail, because of the code mismatches.

The 2 scripts I mentioned are the same. I keep them in synch (the gcd_systems for our workstations, and FWD for Docker and customer use).

If there are updates made to the ncurses code, we should update those script to match, not make new ones. I see several regressions in the attached version, most notably the handling of sources.list.d. And we should update the level of support on https://proj.goldencode.com/downloads/ncurses/ after testing. I believe the Wiki should be updated to reference the FWD version for our customers use, and not include them as attachments.

#8 Updated by Ovidiu Maxiniuc about 1 month ago

Thank you, Roger!
I used an older revision of the script. I merged my changes into the latest.

I re-patched my ncurses, but this time using using -f -uom. The -s will create a broken environment in which the result of the build is only available to root (it requests sudo access), so building ./gradlew native FWD target will fail because of lack of permissions.

#9 Updated by Roger Borrello about 1 month ago

  • reviewer deleted (Roger Borrello)

Ovidiu Maxiniuc wrote:

Thank you, Roger!
I used an older revision of the script. I merged my changes into the latest.

I re-patched my ncurses, but this time using using -f -uom. The -s will create a broken environment in which the result of the build is only available to root (it requests sudo access), so building ./gradlew native FWD target will fail because of lack of permissions.

It isn't intended for a user to use -s. This excerpt from the container project Dockerfile would be where you would want to include -s, as you are positioning for the entire system:

# Setup thread-safe ncurses library
# Step 18/33
COPY setup_ncurses6x.sh /tmp
# Step 19/33
RUN cd /tmp && /tmp/setup_ncurses6x.sh -sap /opt/ncurses
ENV NCURSES_FWD_STATIC=/opt/ncurses
ENV NCURSES_FWD_PTHREADS=true
# Step 20/33
RUN rm -fr /tmp/ncurses* /tmp/setup_ncurses6x.sh

The below excerpt is from the standard workstation load step of the gcd_systems Ansible for roles/ncurses/tasks/main.yml does not include it:

- name: Perform ncurses patching
  ansible.builtin.command: "/home/{{ ansible_user_id }}/bin/setup_ncurses6x.sh -ap {{ ncurses_dir }} -u {{ ansible_user_id }}" 
  args:
    chdir: /tmp
  become: true
  register: ncurses_result
  when: >
    (not ncurses_fwd_pthreads_set)
    or ncurses_file.changed
    or not ncurses_dir_status.stat.exists

So you are using your own download of the sources? Did you try the -a option?

#10 Updated by Roger Borrello about 1 month ago

  • reviewer Roger Borrello added

#11 Updated by Roger Borrello about 1 month ago

Ovidiu, what happens if you use the -a option? I'm just trying to understand when this started happening. Was there a new ncurses positioned?

#12 Updated by Ovidiu Maxiniuc about 1 month ago

I did this previously and I did not like it. The -a parameter requires sudo. As result, the result of the patch/build process will be accessible only to super user, not normal user I use 99.999995% (approximate value) of the time.

The ./setup_ncurses6_4-noWide.sh script ends with success, but attempting to compile the FWD will result in the following error:

gcc -c /mnt/nvme2/projects/work/p2j/src/native/process.c -o process.o -DWORD_SIZE_64 -DFWD_VERSION="\"4.0.0_p2j_trunk_16599\"" -I/usr/lib/jvm/java-17-openjdk-amd64/include -I/usr/lib/jvm/java-17-openjdk-amd64/include/linux -I/mnt/nvme2/projects/work/p2j/src/native -I/home/om/projects/gcd_systems/newNcursesPatch/ncurses-6.4+20240113/include -Wall -fpic -DNCURSES_FWD_USE_PATCH
cc1: error: /home/om/projects/gcd_systems/newNcursesPatch/ncurses-6.4+20240113/include: Permission denied
make: *** [makefile:289: process.o] Error 1

#13 Updated by Roger Borrello about 1 month ago

Ovidiu Maxiniuc wrote:

I did this previously and I did not like it. The -a parameter requires sudo. As result, the result of the patch/build process will be accessible only to super user, not normal user I use 99.999995% (approximate value) of the time.

The ./setup_ncurses6_4-noWide.sh script ends with success, but attempting to compile the FWD will result in the following error:
[...]

Hmm... those commands surrounded by handle_apt are the only ones that would require sudo. See the attached version, which restricts sudo usage to only required locations. That the better way to script, in any case... not requiring the whole script to be sudo.

#14 Updated by Ovidiu Maxiniuc about 1 month ago

Unfortunately, no. The same error when building the native lib.

Of course, I did sudo rm -rf ncurses* before launching the new setup_ncurses6_4-noWide+.sh to be sure the old artefacts are removed.

Here is how it looks after patching:

om@ThinkBook16:~/projects/gcd_systems/newNcursesPatch$ ll ncurses-6.4+20240113/
ls: cannot open directory 'ncurses-6.4+20240113/': Permission denied

#15 Updated by Roger Borrello about 1 month ago

Ovidiu, you must have had some remnants left behind. I just downloaded from this task:
  • setup_ncurses6_4-noWide.sh
  • libncurses_curses_h_in_v6.4+20240113.patch
  • libncurses_lib_getch_c_v6.4+20240113.patch

into ~/projects/ncurses and ran the command: ./setup_ncurses6_4-noWide.sh -ap /home/rfb/ncurses

I was prompted for sudo for the apt commands, then the configure ran. I'm left with my build area:

rfb@rfbvm:~/projects/ncurses$ ls -lart
total 3692
-rw-r--r--  1 rfb rfb     729 Jan 16  2024 ncurses_6.4+20240113.orig.tar.gz.asc
-rw-r--r--  1 rfb rfb 3688489 Jan 16  2024 ncurses_6.4+20240113.orig.tar.gz
-rw-r--r--  1 rfb rfb    3963 Apr  8  2024 ncurses_6.4+20240113-1ubuntu2.dsc
-rw-r--r--  1 rfb rfb   49372 Apr  8  2024 ncurses_6.4+20240113-1ubuntu2.debian.tar.xz
-rwxrwx---  1 rfb rfb    7008 Jun 15 08:29 setup_ncurses6_4-noWide.sh
drwxrwxr-x  4 rfb rfb    4096 Jun 15 08:30 ..
-rw-rw----  1 rfb rfb     536 Jun 15 08:30 libncurses_curses_h_in_v6.4+20240113.patch
-rw-rw----  1 rfb rfb    1005 Jun 15 08:30 libncurses_lib_getch_c_v6.4+20240113.patch
drwxrwx---  3 rfb rfb    4096 Jun 15 08:35 .
drwxrwx--- 20 rfb rfb    4096 Jun 15 08:36 ncurses-6.4+20240113

Can you double check? I was on a system that had run the gcd_systems twice, so it was very clean.

#16 Updated by Roger Borrello about 1 month ago

I did see that I was missing a sudo for the apt get. When I added it in, I had issues:

./setup_ncurses6_4-noWide.sh: line 99: pushd: ncurses-6.4+20240113: Permission denied
patch: **** Can't open patch file ../libncurses_curses_h_in_v6.4+20240113.patch : No such file or directory
patch: **** Can't open patch file ../libncurses_lib_getch_c_v6.4+20240113.patch : No such file or directory
./setup_ncurses6_4-noWide.sh: line 109: ./configure: No such file or directory
make: *** No targets specified and no makefile found.  Stop.
./setup_ncurses6_4-noWide.sh: line 116: cd: include: No such file or directory
+------------------------------------------------------------------------------+
|                 Patched NCURSES libraries update completed.                  |
cp: cannot stat 'include': No such file or directory
cp: cannot stat 'lib': No such file or directory
|              Please do FULL FWD rebuild to activate the changes.             |
+------------------------------------------------------------------------------+
./setup_ncurses6_4-noWide.sh: line 185: popd: directory stack empty
rfb@rfbvm:~/projects/ncurses$ ls -l
total 3744
-rw-rw----  1 rfb  rfb      536 Jun 15 08:30 libncurses_curses_h_in_v6.4+20240113.patch
-rw-rw----  1 rfb  rfb     1005 Jun 15 08:30 libncurses_lib_getch_c_v6.4+20240113.patch
drwxrwx--- 17 root root    4096 Jun 15 08:58 ncurses-6.4+20240113
-rw-r--r--  1 root root   49372 Apr  8  2024 ncurses_6.4+20240113-1ubuntu2.debian.tar.xz
-rw-r--r--  1 root root    3963 Apr  8  2024 ncurses_6.4+20240113-1ubuntu2.dsc
-rw-r--r--  1 root root 3688489 Jan 16  2024 ncurses_6.4+20240113.orig.tar.gz
-rw-r--r--  1 root root     729 Jan 16  2024 ncurses_6.4+20240113.orig.tar.gz.asc
lrwxrwxrwx  1 rfb  rfb        8 Jun 15 08:58 ncurses.h -> curses.h
-rw-rw----  1 rfb  rfb    59512 Jun 15 08:59 screenlog.0
-rwxrwx---  1 rfb  rfb     7013 Jun 15 08:58 setup_ncurses6_4-noWide.sh

Let me take a closer look.

#17 Updated by Roger Borrello about 1 month ago

Roger Borrello wrote:

I did see that I was missing a sudo for the apt get. When I added it in, I had issues:
[...]

Let me take a closer look.

I think the real original problem is you were not including -u om and running as sudo. I recall now that the entire script would need to be run as sudo so that you can achieve the apt-source updates, and the -u allows you to set permissions properly after the ncurses build is performed.

That being said, I do see some bugs in there. There may need to be some refactoring so that it isn't as confusing. The help doesn't make it clear when -u is needed.

#18 Updated by Ovidiu Maxiniuc about 1 month ago

Roger,

The solution which works for me is running the script using -f -uom parameters:
  • -f to get the patch applied;
  • -uom to get the ~/.bashrc updated.

This does not require root privileges and, indeed, will create the files/folders with file-access permission only for current user. That is, other users will not be able to read the ncurses binaries, but momentarily, I do not have other users configured on my machine.

I reckon, this is not the best solution. To improve it, the script should be run with rot credentials, but it should also use chmod to make those artefacts system-wide accessible (I guess -s, which seems like the opposite of -u would do that). Please correct me if I'm wrong.

#19 Updated by Roger Borrello about 1 month ago

  • Related to Support #2660: evaluate if the NCURSES 5.7 "threading improvements" can be made to work for P2J such that auto_getch_refresh() is no longer needed added

#20 Updated by Roger Borrello about 1 month ago

Ovidiu Maxiniuc wrote:

Roger,

The solution which works for me is running the script using -f -uom parameters:
  • -f to get the patch applied;
  • -uom to get the ~/.bashrc updated.

This does not require root privileges and, indeed, will create the files/folders with file-access permission only for current user. That is, other users will not be able to read the ncurses binaries, but momentarily, I do not have other users configured on my machine.

I reckon, this is not the best solution. To improve it, the script should be run with root credentials, but it should also use chmod to make those artifacts system-wide accessible (I guess -s, which seems like the opposite of -u would do that). Please correct me if I'm wrong.

I really had to scrape the cobwebs on this, because Eugenie had done the heavy lifting so that we could avoid having to patch ncurses with auto_getch_refresh (ref #2660). That's when the -f option was introduced, so that you could use the old method (dynamically linked) instead of the preferred static linking.

The system-wide update option is not used in the Ansible playbook, whether installing on a workstation or server. It is used in the base docker image creation, so that the base development image contains ncurses setup for static linking:

rfb@basedev_ubuntu_2404_latest_container:~/projects/fwd/trunk$ sudo cat /etc/sudoers.d/10-ncurses 
[sudo] password for rfb: 
Defaults env_keep += NCURSES_FWD_STATIC
Defaults env_keep += NCURSES_FWD_PTHREADS
rfb@basedev_ubuntu_2404_latest_container:~/projects/fwd/trunk$ sudo cat /etc/profile.d/10-ncurses.sh

# set up thread-safe NCURSES root location
# and set up thread-safe NCURSES_FWD_PTHREADS variable
export NCURSES_FWD_STATIC="/opt/ncurses" 
export NCURSES_FWD_PTHREADS=true

That is required so that any environment that is started under the Docker image contains the environment variables. You shouldn't ever need to run with that option.

The -a option is there so that the sources list can be handled by the script itself, and not have to be done outside on your own. This is where there might need to be some better handling of the privileges, because you cannot handle apt without root. You might be able to get away with root for the entire script, if the user setup is done properly.

#21 Updated by Ovidiu Maxiniuc about 1 month ago

Most likely, I used -s last week (possibly before that also). But I think I 'repaired' the damage by dropping the artefacts which required account elevation. OTOH, -a seem logical, but momentarily does not work for me for the reasons you also noted in #11515-16.

As noted above, -f -uom works for me currently. But, from #2660, I understand that the auto_getch_refresh is not mandatory any more? Not very clear from the wikis. If this is the case, I/we can safely switch to pthread alternative and drop the patching resources completely.

#22 Updated by Roger Borrello about 1 month ago

  • Status changed from New to Review
  • % Done changed from 0 to 90
  • Assignee changed from Ovidiu Maxiniuc to Roger Borrello
  • File setup_ncurses6_4-noWide.shMagnifier added
  • reviewer Eugenie Lyzenko, Hynek Cihlar added
  • reviewer deleted (Roger Borrello)

Ovidiu Maxiniuc wrote:

Most likely, I used -s last week (possibly before that also). But I think I 'repaired' the damage by dropping the artefacts which required account elevation. OTOH, -a seem logical, but momentarily does not work for me for the reasons you also noted in #11515-16.

As noted above, -f -uom works for me currently. But, from #2660, I understand that the auto_getch_refresh is not mandatory any more? Not very clear from the wikis. If this is the case, I/we can safely switch to pthread alternative and drop the patching resources completely.

I have completed a Claude code review, and there were a lot of problem spots. The updates are in the attached. I'd love a review, since you've had your nose in this. Eugenie, are you also able to review?

I see that you added the --disable-widec for the patched build. I don't have a problem with that, as I don't know where we would actually need it. We really won't need a separate version, so I will be renaming this to setup_ncurses6x.sh if accepted. Regarding the updated patching, this is also a call from Eugenie and/or Greg, because on the one hand, we should keep updated with NCURSES updates. But on the other, are we not trying to deprecate usage of static linking?

#23 Updated by Roger Borrello about 1 month ago

I forgot to mention that I updated the usage:

Usage: ./setup_ncurses6x.sh [-p<path>] [-fsad] [-u<user>]
Where:
p    = Use specific path instead of current directory
f    = Override thread-safe dynamically linked version with statically linked patched version containing auto_getch_refresh
s    = Set system-wide environment instead of just current user
a    = Handle setup of /etc/apt/sources.list and restore when done (requires sudo)
u    = Update the given user's .bashrc instead of current running user. Typically for when run under sudo
d    = Dry run. Just show commands.

#24 Updated by Ovidiu Maxiniuc about 1 month ago

  • reviewer Greg Shah added
  • reviewer deleted (Hynek Cihlar)

Roger,
Actually, some of the changes in the script were suggested by Eugenie. I bothered him a bit last week in need for help. I take this opportunity to thank him again!

#25 Updated by Eugenie Lyzenko about 1 month ago

Roger Borrello wrote:

Ovidiu Maxiniuc wrote:

Most likely, I used -s last week (possibly before that also). But I think I 'repaired' the damage by dropping the artefacts which required account elevation. OTOH, -a seem logical, but momentarily does not work for me for the reasons you also noted in #11515-16.

As noted above, -f -uom works for me currently. But, from #2660, I understand that the auto_getch_refresh is not mandatory any more? Not very clear from the wikis. If this is the case, I/we can safely switch to pthread alternative and drop the patching resources completely.

I have completed a Claude code review, and there were a lot of problem spots. The updates are in the attached. I'd love a review, since you've had your nose in this. Eugenie, are you also able to review?

I see that you added the --disable-widec for the patched build. I don't have a problem with that, as I don't know where we would actually need it. We really won't need a separate version, so I will be renaming this to setup_ncurses6x.sh if accepted. Regarding the updated patching, this is also a call from Eugenie and/or Greg, because on the one hand, we should keep updated with NCURSES updates. But on the other, are we not trying to deprecate usage of static linking?

I'm OK with changes.

About --disable-widec. This is mandatory since Ubuntu 24.0. The reason is by default the wide char version of NCURSES is installed on 24.04. You can see it with any package manager. Previously (22.04) it was not true. So the if wide char option is not specified the 24.04 think the wide char feature is enabled. The FWD has no support for wide char so we have to explicitly disable it with NCURSES config. Otherwise wrong libraries will be compiled with wrong name (with *w.* suffix).

#26 Updated by Roger Borrello about 1 month ago

  • vendor_id deleted (GCD)
  • Assignee changed from Roger Borrello to Eric Faulhaber

OK. I can update the gcd_systems version with this updated version, although I do need a determination if the patch is to be updated (and the repository would need a corresponding change). Then there is tools/scripts/setup_ncurses6x.sh, which would need a branch.

#27 Updated by Ovidiu Maxiniuc about 1 month ago

Roger,
The latest patches and the script attached to this task only work with Ubuntu 24.4. Older revisions of the OS will not be processed correctly. Shouldn't we have some selector for them?

Also, the patches (if they will be kept) will have to be fetched from GC webpage, because (temporarily, for debugging) the script has the download disabled but expects to find them locally.

#28 Updated by Roger Borrello about 1 month ago

We could add the logic in the script like below. If we confirm the patch levels are correct for the releases noted:

# patching the source files
$dry pushd ncurses-6.* > /dev/null || { echo "Unable to enter NCURSES source directory (ncurses-6.*)!"; exit 1; }
if [[ "$patch_ncurses" == true ]]; then
   case "$release" in
      focal|jammy)   # Ubuntu 20.04 / 22.04 (ncurses 6.2 / 6.3)
          patch_h="ncurses_curses_h_in_v6.1_20200708.patch" 
          patch_c="ncurses_lib_getch_c_v6.1_20200708.patch" ;;
      noble)         # Ubuntu 24.04 (ncurses 6.4)
          patch_h="ncurses_curses_h_in_v6.4+20240113.patch" 
          patch_c="ncurses_lib_getch_c_v6.4+20240113.patch" ;;
      *)             # unknown / newer - assume newest, but say so
          echo "Warning: unrecognized release '$release'; using newest NCURSES patch set" >&2
          patch_h="ncurses_curses_h_in_v6.4+20240113.patch" 
          patch_c="ncurses_lib_getch_c_v6.4+20240113.patch" ;;
   esac

   $dry wget https://proj.goldencode.com/downloads/ncurses/${patch_h} || { echo "Failed to download ${patch_h} patch!"; exit 1; }
   $dry wget https://proj.goldencode.com/downloads/ncurses/${patch_c} || { echo "Failed to download ${patch_c} patch!"; exit 1; }
   $dry patch include/curses.h.in ${patch_h}
   $dry patch ncurses/base/lib_getch.c ${patch_c}
   $dry ./configure --with-termlib CFLAGS='-fPIC -O2' --with-abi-version=6 --disable-widec
else
   $dry ./configure --with-termlib CFLAGS='-fPIC -O2' --with-abi-version=6 --disable-widec --with-pthread --enable-pthreads-eintr
fi
$dry make
make_rc=$?
if [ "$make_rc" -ne 0 ] && [ -z "$dry" ]; then
   echo "NCURSES build failed (make returned $make_rc); aborting before any environment changes." >&2
   exit 1
fi

#29 Updated by Roger Borrello about 1 month ago

  • vendor_id set to GCD
  • Assignee changed from Eric Faulhaber to Roger Borrello

#30 Updated by Roger Borrello 26 days ago

Can we get the ncurses_curses_h_in_v6.4+20240113.patch and ncurses_lib_getch_c_v6.4+20240113.patch files uploaded to https://proj.goldencode.com/downloads/ncurses/ so we can get this task closed?

#31 Updated by Greg Shah 26 days ago

You have sufficient rights on projsrv01 to do it.

#32 Updated by Roger Borrello 26 days ago

Greg Shah wrote:

You have sufficient rights on projsrv01 to do it.

I'll take that as approval (whereas if you did it, it would certainly be approved :-)

#33 Updated by Roger Borrello 26 days ago

  • % Done changed from 90 to 100

Roger Borrello wrote:

Greg Shah wrote:

You have sufficient rights on projsrv01 to do it.

I'll take that as approval (whereas if you did it, it would certainly be approved :-)

Done:

sudo ls -l /opt/downloads/ncurses/
-rw-r----- 1 www-data www-data  536 Jun 25 12:35 libncurses_curses_h_in_v6.4+20240113.patch
-rw-r----- 1 www-data www-data 1005 Jun 25 12:35 libncurses_lib_getch_c_v6.4+20240113.patch
-r-xr-x--- 1 www-data www-data  561 Nov 11  2016 ncurses_curses_h_in_20060828.patch
-r-xr-x--- 1 www-data www-data  899 Nov 11  2016 ncurses_curses_h_in_v5.9_20160219.solaris.patch
-r-xr-x--- 1 www-data www-data  561 Jul  9  2020 ncurses_curses_h_in_v6.1_20200708.patch
-r-xr-x--- 1 www-data www-data 1027 Nov 11  2016 ncurses_lib_getch_c_20060828.patch
-r-xr-x--- 1 www-data www-data 1044 Nov 11  2016 ncurses_lib_getch_c_v5.7_20090512.patch
-r-xr-x--- 1 www-data www-data 1044 Nov 11  2016 ncurses_lib_getch_c_v5.9_20160219.solaris.patch
-r-xr-x--- 1 www-data www-data 1044 Jul  9  2020 ncurses_lib_getch_c_v6.1_20200708.patch

Should I create a branch for tools/scripts/setup_ncurses6x.sh or just put it in 9709e, where I have other tools updates? Or better yet, I have 10491a branch where I could collect tools/scripts/fwd_create_pg_cluster.sh and tools/docker updates.

#34 Updated by Ovidiu Maxiniuc 26 days ago

I think we should have different scripts for each OS. At least for latest 2-3 LTS. I am not sure whether:
  • the name should specify the ncurses exact version (like I did above with setup_ncurses6.4.sh) or
  • use the OS version instead: setup_ncurses_24.4.sh. This assumes this OS is always using the same ncurses library.

Shouldn't we then put the script in same location for download? Of course, after enabling the wget lines for the resources Roger has just uploaded.

#35 Updated by Roger Borrello 26 days ago

Ovidiu Maxiniuc wrote:

I think we should have different scripts for each OS. At least for latest 2-3 LTS. I am not sure whether:
  • the name should specify the ncurses exact version (like I did above with setup_ncurses6.4.sh) or
  • use the OS version instead: setup_ncurses_24.4.sh. This assumes this OS is always using the same ncurses library.

See the attached which is in revision 195 of gcd_systems. I believe it should be smart enough to know which OS it is executing on, and match up with our specified static patch (which is something we are moving away from in favor of the thread-safe version, aren't we?)

Having multiple versions would be more cumbersome to maintain. If there is a requirement to patch older/newer versions of ncurses from any OS, we might want to specify an override option for the most flexibility.

Shouldn't we then put the script in same location for download? Of course, after enabling the wget lines for the resources Roger has just uploaded.

We keep the script in with FWD at tools/scripts/, so no separate step is required for retrieval. (The wget lines are enabled in this version).

#36 Updated by Greg Shah 26 days ago

Why are you changing the naming convention? Please rename the patch files to match the convention used for the older ncurses patch file names.

I think we should have different scripts for each OS. At least for latest 2-3 LTS.

We've always been able to handle multiple versions (of OS and of NCURSES) with a single script. Let's stick with that approach.

#37 Updated by Roger Borrello 26 days ago

Greg Shah wrote:

Why are you changing the naming convention? Please rename the patch files to match the convention used for the older ncurses patch file names.

I was just using what I was given... here's the newly named files, in line:

-r-xr-x--- 1 www-data www-data  561 Nov 11  2016 ncurses_curses_h_in_20060828.patch
-r-xr-x--- 1 www-data www-data  899 Nov 11  2016 ncurses_curses_h_in_v5.9_20160219.solaris.patch
-r-xr-x--- 1 www-data www-data  561 Jul  9  2020 ncurses_curses_h_in_v6.1_20200708.patch
-r-xr-x--- 1 www-data www-data  536 Jun 25 12:35 ncurses_curses_h_in_v6.4_20240113.patch
-r-xr-x--- 1 www-data www-data 1027 Nov 11  2016 ncurses_lib_getch_c_20060828.patch
-r-xr-x--- 1 www-data www-data 1044 Nov 11  2016 ncurses_lib_getch_c_v5.7_20090512.patch
-r-xr-x--- 1 www-data www-data 1044 Nov 11  2016 ncurses_lib_getch_c_v5.9_20160219.solaris.patch
-r-xr-x--- 1 www-data www-data 1044 Jul  9  2020 ncurses_lib_getch_c_v6.1_20200708.patch
-r-xr-x--- 1 www-data www-data 1005 Jun 25 12:35 ncurses_lib_getch_c_v6.4_20240113.patch

I'll update the script to match.

#38 Updated by Roger Borrello 26 days ago

Here's the code block where we decide which to use... we don't have a method to pull in the very old versions for patching.

$dry pushd ncurses-6.* > /dev/null || { echo "Unable to enter NCURSES source directory (ncurses-6.*)!"; exit 1; }
if [[ "$patch_ncurses" == true ]]; then
   case "$release" in
      focal|jammy)   # Ubuntu 20.04 / 22.04 (ncurses 6.2 / 6.3)
          patch_h="ncurses_curses_h_in_v6.1_20200708.patch" 
          patch_c="ncurses_lib_getch_c_v6.1_20200708.patch" ;;
      noble)         # Ubuntu 24.04 (ncurses 6.4)
          patch_h="ncurses_curses_h_in_v6.4_20240113.patch" 
          patch_c="ncurses_lib_getch_c_v6.4_20240113.patch" ;;
      *)             # unknown / newer - assume newest, but say so
          echo "Warning: unrecognized release '$release'; using newest NCURSES patch set" >&2
          patch_h="ncurses_curses_h_in_v6.4_20240113.patch" 
          patch_c="ncurses_lib_getch_c_v6.4_20240113.patch" ;;
   esac

   $dry wget https://proj.goldencode.com/downloads/ncurses/${patch_h} || { echo "Failed to download ${patch_h} patch!"; exit 1; }
   $dry wget https://proj.goldencode.com/downloads/ncurses/${patch_c} || { echo "Failed to download ${patch_c} patch!"; exit 1; }
   $dry patch include/curses.h.in "${patch_h}" 
   $dry patch ncurses/base/lib_getch.c "${patch_c}" 
else
   # Add configure flags for thread-safe dynamically linked ncurses
   ncurses_configure_flags+=(--with-pthread --enable-pthreads-eintr)
fi

#39 Updated by Ovidiu Maxiniuc 26 days ago

Roger Borrello wrote:

Greg Shah wrote:

Why are you changing the naming convention? Please rename the patch files to match the convention used for the older ncurses patch file names.

I was just using what I was given... here's the newly named files, in line:
[...]
I'll update the script to match.

That's my fault. My apologies. I used the names from downloaded library instead of GC convention. Thank you Roger for fixing the file names. The script still used ncurses_curses_h_in_v6.4+20240113.patch instead of ncurses_curses_h_in_v6.4_20240113.patch in r195 although in note-38 and r197 they look OK. Nice update!

#40 Updated by Roger Borrello 26 days ago

Ovidiu Maxiniuc wrote:

That's my fault. My apologies. I used the names from downloaded library instead of GC convention. Thank you Roger for fixing the file names. The script still used ncurses_curses_h_in_v6.4+20240113.patch instead of ncurses_curses_h_in_v6.4_20240113.patch in r195 although in note-38 and r197 they look OK. Nice update!

No problem... The version checked into gcd_systems is correct. We need to include that in a branch.

=== modified file 'roles/ncurses/files/setup_ncurses6x.sh'
--- old/roles/ncurses/files/setup_ncurses6x.sh  2026-06-25 17:52:27 +0000
+++ new/roles/ncurses/files/setup_ncurses6x.sh  2026-06-25 19:05:57 +0000
@@ -128,12 +128,12 @@
           patch_h="ncurses_curses_h_in_v6.1_20200708.patch" 
           patch_c="ncurses_lib_getch_c_v6.1_20200708.patch" ;;
       noble)         # Ubuntu 24.04 (ncurses 6.4)
-          patch_h="ncurses_curses_h_in_v6.4+20240113.patch" 
-          patch_c="ncurses_lib_getch_c_v6.4+20240113.patch" ;;
+          patch_h="ncurses_curses_h_in_v6.4_20240113.patch" 
+          patch_c="ncurses_lib_getch_c_v6.4_20240113.patch" ;;
       *)             # unknown / newer - assume newest, but say so
           echo "Warning: unrecognized release '$release'; using newest NCURSES patch set" >&2
-          patch_h="ncurses_curses_h_in_v6.4+20240113.patch" 
-          patch_c="ncurses_lib_getch_c_v6.4+20240113.patch" ;;
+          patch_h="ncurses_curses_h_in_v6.4_20240113.patch" 
+          patch_c="ncurses_lib_getch_c_v6.4_20240113.patch" ;;
    esac

    $dry wget https://proj.goldencode.com/downloads/ncurses/${patch_h} || { echo "Failed to download ${patch_h} patch!"; exit 1; }

Also available in: Atom PDF