Source: yambar
Followup-For: Bug #1128761
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 with glibc 2.43. There are two spots;
the second one (modules/script.c) isn't in the original log because ninja
stops at the first failure:

 - tag.c: tag_args[] point into the local, writable tag_name_and_arg
   copy, and the code writes a '\0' through the strchr() result, so the
   const on tag_args/arg is just unneeded. Dropped it.
 - modules/script.c: line_end = memchr(line, ...) with a const line;
   line_end is only read, so it is now const char *.

Upstream (codeberg.org/dnkl/yambar) is no longer developed. FWIW the
maintained continuation is maybar (https://codeberg.org/mathstuf/maybar).
It has the same two spots: they were reported as maybar #40/#41 and closed
as "C23 only". But glibc 2.43 triggers them even with the -std=c18 the
package already builds with, as your build log shows.

We are carrying it in Ubuntu as yambar 1.11.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 build with glibc 2.43 (ISO C23 const-preserving strchr/memchr)
 glibc 2.43 makes strchr() and memchr() return a const-qualified pointer
 when passed a const-qualified one, which -Werror turns into build failures:
  - tag.c: tag_args[] point into the local, writable tag_name_and_arg copy
    and the code writes a '\0' through the strchr() result, so drop the
    unneeded const from tag_args/arg.
  - modules/script.c: line_end is only read, make it const.
Author: Sebastien Bacher <[email protected]>
Bug-Debian: https://bugs.debian.org/1128761
Forwarded: not-needed
Last-Update: 2026-10-14

--- a/tag.c
+++ b/tag.c
@@ -476,7 +476,7 @@
 
         static const size_t MAX_TAG_ARGS = 4;
         const char *tag_name = NULL;
-        const char *tag_args[MAX_TAG_ARGS];
+        char *tag_args[MAX_TAG_ARGS];
         memset(tag_args, 0, sizeof(tag_args));
 
         {
@@ -484,7 +484,7 @@
             tag_name = strtok_r(tag_name_and_arg, ":", &saveptr);
 
             for (size_t i = 0; i < MAX_TAG_ARGS; i++) {
-                const char *arg = strtok_r(NULL, ":", &saveptr);
+                char *arg = strtok_r(NULL, ":", &saveptr);
                 if (arg == NULL)
                     break;
                 tag_args[i] = arg;
--- a/modules/script.c
+++ b/modules/script.c
@@ -265,7 +265,7 @@
     size_t idx = 0;
 
     while (left > 0) {
-        char *line_end = memchr(line, '\n', left);
+        const char *line_end = memchr(line, '\n', left);
         assert(line_end != NULL);
 
         size_t line_len = line_end - line;

Reply via email to