Source: hexcurse
Followup-For: Bug #1128548
X-Debbugs-Cc: [email protected]
User: [email protected]
Usertags: origin-ubuntu stonking ubuntu-patch
Control: tags -1 patch ftbfs

Hi,

The attached patch fixes the build. In _getopt_internal() the result of
my_index() (#define'd to strchr) on the const optstring is only ever read,
so the local can simply be declared const char *.

We are carrying it in Ubuntu as hexcurse 1.60.0-2ubuntu1.

Cheers,
Sebastien


-- System Information:
Debian Release: forky/sid
  APT prefers resolute-updates
  APT policy: (500, 'resolute-updates'), (500, 'resolute-security'), (500, 
'resolute'), (100, 'resolute-backports')
Architecture: amd64 (x86_64)

Kernel: Linux 7.0.0-38-generic (SMP w/16 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_WARN, TAINT_OOT_MODULE
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Description: Fix FTBFS with glibc 2.43 (ISO C23 const-preserving strchr)
 With glibc 2.43, strchr() returns a const-qualified pointer when passed a
 const-qualified string. optstring is const char *, so assigning the result
 to a plain char * triggers -Wdiscarded-qualifiers, fatal with -Werror.
 temp is only ever read, so declare it const.
Author: Sebastien Bacher <[email protected]>
Bug-Debian: https://bugs.debian.org/1128548
Forwarded: no
Last-Update: 2026-10-13

--- a/src/getopt.c
+++ b/src/getopt.c
@@ -358,7 +358,7 @@ _getopt_internal (int argc, char *const
 
   {
     char c = *nextchar++;
-    char *temp = my_index (optstring, c);
+    const char *temp = my_index (optstring, c);
 
     /* Increment `optind' when we start to process its last character.  */
     if (*nextchar == '\0')

Reply via email to