]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
util-linux: Fix build against glibc >= 2.43
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 24 Jan 2026 15:46:42 +0000 (15:46 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 28 Jan 2026 11:29:23 +0000 (11:29 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
lfs/util-linux
src/patches/util-linux-2.41.2-FTBFS-bsearch.patch [new file with mode: 0644]

index 8c2dc264863b60aa0ba9ed04196b9c2002f9bd3e..ce00f1a391cce8fb6c83e4e0c45b3d63c51dc844 100644 (file)
@@ -74,6 +74,7 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
        @$(PREBUILD)
        @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE)
        $(UPDATE_AUTOMAKE)
+       cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/util-linux-2.41.2-FTBFS-bsearch.patch
        cd $(DIR_APP) && ./configure \
                                --docdir=/usr/share/doc/util-linux \
                                --disable-chfn-chsh \
diff --git a/src/patches/util-linux-2.41.2-FTBFS-bsearch.patch b/src/patches/util-linux-2.41.2-FTBFS-bsearch.patch
new file mode 100644 (file)
index 0000000..979cbf1
--- /dev/null
@@ -0,0 +1,40 @@
+From 711bda1441561bfd2eb6d45fe0bc789535c1f1a8 Mon Sep 17 00:00:00 2001
+From: =?utf8?q?Cristian=20Rodr=C3=ADguez?= <cristian@rodriguez.im>
+Date: Sat, 22 Nov 2025 10:41:08 -0300
+Subject: [PATCH] lsfd: fix bsearch macro usage with glibc C23
+MIME-Version: 1.0
+Content-Type: text/plain; charset=utf8
+Content-Transfer-Encoding: 8bit
+
+C23 requires bsearch to be a const preserving macro, build now fails
+with
+
+../lsfd-cmd/lsfd.c:1879:75: error: macro â\80\98bsearchâ\80\99 passed 6 arguments, but takes just 5
+ 1879 |                                     nfds, sizeof(struct pollfd), pollfdcmp))
+      |                                                                           ^
+In file included from ../include/c.h:17,
+                 from ../lsfd-cmd/lsfd.c:48:
+/usr/include/stdlib.h:987:10: note: macro â\80\98bsearchâ\80\99 defined here
+  987 | # define bsearch(KEY, BASE, NMEMB, SIZE, COMPAR)                        \
+
+  add parenthesis around expression to fix it.
+---
+ lsfd-cmd/lsfd.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lsfd-cmd/lsfd.c b/lsfd-cmd/lsfd.c
+index 335594144..4da86c602 100644
+--- a/lsfd-cmd/lsfd.c
++++ b/lsfd-cmd/lsfd.c
+@@ -1875,7 +1875,7 @@ static void mark_poll_fds_as_multiplexed(char *buf,
+               struct file *file = list_entry(f, struct file, files);
+               if (is_opened_file(file) && !file->multiplexed) {
+                       int fd = file->association;
+-                      if (bsearch(&(struct pollfd){.fd = fd,}, local.iov_base,
++                      if (bsearch((&(struct pollfd){.fd = fd,}), local.iov_base,
+                                   nfds, sizeof(struct pollfd), pollfdcmp))
+                               file->multiplexed = 1;
+               }
+-- 
+2.47.3
+