From 4cf0fd8e9e3f05ec2e2841ef496abb89573d41f8 Mon Sep 17 00:00:00 2001 From: Jean-Michel Hautbois Date: Wed, 25 Sep 2024 09:48:27 +0200 Subject: [PATCH] package/coreutils: fix build with uClibc-ng When compiling coreutils with uClibc-ng, build is failing with error: In file included from lib/mcel.c:3: lib/mcel.h: In function 'mcel_scan': lib/mcel.h:226:21: error: 'mbstate_t' has no member named '__count' 226 | mbstate_t mbs; mbs.__count = 0; | ^ The problem was reported by Waldemar Brodkorb in: https://lists.gnu.org/r/bug-gnulib/2024-08/msg00130.html This commit adds a package patch that modifies mcel_scan to avoid treating uClibc-ng as if it were glibc, resolving compatibility issues. Specifically, uClibc-ng was incorrectly treated like glibc in the code, which led to incorrect assumptions about the mbstate_t initialization. Fixes: - https://autobuild.buildroot.org/results/34f4e23e325a03ab37fd5a0a564780b9e0d631cd/ Signed-off-by: Jean-Michel Hautbois [Julien: - slightly reworded the commit log - fixed package patch encoding - add the Upstream: tag in package patch - add the Fixes: link in commit log ] Signed-off-by: Julien Olivain --- ...001-coreutils-mcel-port-to-uClibc-ng.patch | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 package/coreutils/0001-coreutils-mcel-port-to-uClibc-ng.patch diff --git a/package/coreutils/0001-coreutils-mcel-port-to-uClibc-ng.patch b/package/coreutils/0001-coreutils-mcel-port-to-uClibc-ng.patch new file mode 100644 index 0000000000..7639509ff2 --- /dev/null +++ b/package/coreutils/0001-coreutils-mcel-port-to-uClibc-ng.patch @@ -0,0 +1,35 @@ +From c4e923a98f34fe5f5ec3b49543e90716ec2a45fc Mon Sep 17 00:00:00 2001 +From: Jean-Michel Hautbois +Date: Tue, 24 Sep 2024 18:08:31 +0200 +Subject: [PATCH] coreutils: mcel: port to uClibc-ng +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Problem reported by Waldemar Brodkorb in: +https://lists.gnu.org/r/bug-gnulib/2024-08/msg00130.html +* lib/mcel.h (mcel_scan): Don't treat uClibc-ng like glibc. + +Upstream: https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=9765bc796b3e6ceaa7a10ba07c9c2f1e272a4249 +Signed-off-by: Jean-Michel Hautbois +--- + lib/mcel.h | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/lib/mcel.h b/lib/mcel.h +index f6f006c..dca4d08 100644 +--- a/lib/mcel.h ++++ b/lib/mcel.h +@@ -221,7 +221,8 @@ mcel_scan (char const *p, char const *lim) + + /* An initial mbstate_t; initialization optimized for some platforms. + For details about these and other platforms, see wchar.in.h. */ +-#if defined __GLIBC__ && 2 < __GLIBC__ + (2 <= __GLIBC_MINOR__) ++#if (defined __GLIBC__ && 2 < __GLIBC__ + (2 <= __GLIBC_MINOR__) \ ++ && !defined __UCLIBC__) + /* Although only a trivial optimization, it's worth it for GNU. */ + mbstate_t mbs; mbs.__count = 0; + #elif (defined __FreeBSD__ || defined __DragonFly__ || defined __OpenBSD__ \ +-- +2.39.2 +