On 2025-09-10 04:46, Pádraig Brady wrote:
coreutils CI is failing with latest gnulib in regex_internal.h
saying that the new macro is undefined.

It seems like these two files at least, should include gettext.h:

$ git grep -l GNULIB_TEXT_DOMAIN | grep '\.[ch]$' | xargs grep -LF gettext.h
lib/argmatch.c
lib/regex_internal.h

argmatch.c is OK as it includes argmatch.h, which includes gettext.h.

regex.c is indeed a problem. Thanks for reporting it. I missed it because I tested on Fedora 42, where regex.c isn't compiled.

I wasn't sure exactly
how to handle regex_internal.h given the overlap with libc.

I installed the attached, which should do the right thing. Tested on Fedora 42 with Savannah master coreutils+gnulib configured --with-included-regex.
From d4cdb40ad1254b834d69a76c4e2a393ea09cf45c Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email protected]>
Date: Wed, 10 Sep 2025 08:33:49 -0700
Subject: [PATCH] regex: fix support for overriding "gnulib"
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Problem reported by Pádraig Brady in:
https://lists.gnu.org/r/bug-gnulib/2025-09/msg00104.html
* lib/regex_internal.h [!_LIBC]: Simplify by including gettext.h
rather than doing things by hand and mishandling GNULIB_TEXT_DOMAIN.
(gettext_noop) [!_LIBC]: Remove, since gettext.h does that now.
* modules/regex (Depends-on): Add gettext-h.
---
 ChangeLog            | 10 ++++++++++
 lib/regex_internal.h | 18 ++++--------------
 modules/regex        |  1 +
 3 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index fd6965d404..8b83dca9f6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2025-09-10  Paul Eggert  <[email protected]>
+
+	regex: fix support for overriding "gnulib"
+	Problem reported by Pádraig Brady in:
+	https://lists.gnu.org/r/bug-gnulib/2025-09/msg00104.html
+	* lib/regex_internal.h [!_LIBC]: Simplify by including gettext.h
+	rather than doing things by hand and mishandling GNULIB_TEXT_DOMAIN.
+	(gettext_noop) [!_LIBC]: Remove, since gettext.h does that now.
+	* modules/regex (Depends-on): Add gettext-h.
+
 2025-09-09  Pádraig Brady  <[email protected]>
 
 	maintainer-makefile: relax coverage requirements
diff --git a/lib/regex_internal.h b/lib/regex_internal.h
index 855025e13b..03893b8630 100644
--- a/lib/regex_internal.h
+++ b/lib/regex_internal.h
@@ -98,24 +98,14 @@
 #endif
 
 /* This is for other GNU distributions with internationalized messages.  */
-#if (HAVE_LIBINTL_H && ENABLE_NLS) || defined _LIBC
+#ifdef _LIBC
 # include <libintl.h>
 # undef gettext
-# ifdef _LIBC
-#  define gettext(msgid) \
+# define gettext(msgid) \
   __dcgettext (_libc_intl_domainname, msgid, LC_MESSAGES)
-# else
-#  define gettext(msgid) dgettext (GNULIB_TEXT_DOMAIN, msgid)
-# endif
-#else
-# undef gettext
-# define gettext(msgid) (msgid)
-#endif
-
-#ifndef gettext_noop
-/* This define is so xgettext can find the internationalizable
-   strings.  */
 # define gettext_noop(String) String
+#else
+# include "gettext.h"
 #endif
 
 /* Number of ASCII characters.  */
diff --git a/modules/regex b/modules/regex
index 34802a4a94..75e897edde 100644
--- a/modules/regex
+++ b/modules/regex
@@ -22,6 +22,7 @@ vararrays
 attribute               [test $ac_use_included_regex = yes]
 btowc                   [test $ac_use_included_regex = yes]
 builtin-expect          [test $ac_use_included_regex = yes]
+gettext-h               [test $ac_use_included_regex = yes]
 glibc-internal/dynarray [test $ac_use_included_regex = yes]
 gnulib-i18n             [test $ac_use_included_regex = yes]
 intprops                [test $ac_use_included_regex = yes]
-- 
2.48.1

Reply via email to