In C23 mode, glibc 2.43 strchr preserves the const qualification of its input. The bundled option parser assigns the result for the const optstring to a mutable pointer, which fails with -Werror=discarded-qualifiers.
Make the local pointer const: it is only used to inspect the option and its argument markers. Keep the compiler standard and warning checks unchanged. Closes: #1128548 --- debian/patches/glibc-2.43-const.patch | 21 +++++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 22 insertions(+) create mode 100644 debian/patches/glibc-2.43-const.patch diff --git a/debian/patches/glibc-2.43-const.patch b/debian/patches/glibc-2.43-const.patch new file mode 100644 index 0000000..f6e848e --- /dev/null +++ b/debian/patches/glibc-2.43-const.patch @@ -0,0 +1,21 @@ +Description: Preserve const qualification when scanning the option string + In C23 mode, glibc 2.43 strchr preserves the const qualification of its + input. optstring is const char *, and temp only reads the matching + option and its argument markers. Declare temp const to avoid discarding + the qualifier and failing the build with -Werror=discarded-qualifiers. +Author: Troy Mitchell <[email protected]> +Bug-Debian: https://bugs.debian.org/1128548 +Forwarded: no +Last-Update: 2026-09-17 + +--- a/src/getopt.c ++++ b/src/getopt.c +@@ -358,7 +358,7 @@ + + { + 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') diff --git a/debian/patches/series b/debian/patches/series index 25ce50e..95308d8 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -4,3 +4,4 @@ fix_ftbfs.patch gcc-10.patch 0001-Fix-string-format-errors-with-recent-ncurses.patch gcc-15.patch +glibc-2.43-const.patch -- 2.55.0

