On 18/09/2026 17:28, Paul Eggert wrote:
On 9/18/26 08:07, Pádraig Brady wrote:
Do we need an explicit check for the issue to enable the replacement?
Looks like it, yes. (We should also fix glibc of course....)
OK cool.
With the attached, all gnulib tests pass on glibc-2.44.9000-2.fc46.x86_64
cheers,
Padraig
From 7b096e3ab92b639de98841e10544581af88d8474 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <[email protected]>
Date: Sat, 19 Sep 2026 12:45:14 +0100
Subject: [PATCH] regex: check for glibc greek locale bug 20381
test-regex-el fails on glibc-2.44.9000-2.fc46.x86_64
due to regex not being replaced there.
gnulib was patched to fix the bug in commit 0eb6867f9c.
* m4/regex.m4 (gl_REGEX): Check for
<https://sourceware.org/bugzilla/show_bug.cgi?id=20381>
---
ChangeLog | 8 ++++++++
m4/regex.m4 | 38 ++++++++++++++++++++++++++++++++++++++
2 files changed, 46 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index e12500f82f..702ef12153 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2026-09-19 Pádraig Brady <[email protected]>
+
+ regex: check for glibc greek locale bug 20381
+ test-regex-el fails on glibc-2.44.9000-2.fc46.x86_64
+ due to regex not being replaced there.
+ * m4/regex.m4 (gl_REGEX): Check for
+ <https://sourceware.org/bugzilla/show_bug.cgi?id=20381>
+
2026-09-16 Bruno Haible <[email protected]>
c32rtomb: Make consistent with mbrtoc32 in the C locale.
diff --git a/m4/regex.m4 b/m4/regex.m4
index 4a7257d892..58559d97ad 100644
--- a/m4/regex.m4
+++ b/m4/regex.m4
@@ -36,6 +36,7 @@ AC_DEFUN([gl_REGEX],
[AC_LANG_PROGRAM(
[[#include <regex.h>
+ #include <ctype.h>
#include <locale.h>
#include <limits.h>
#include <string.h>
@@ -351,6 +352,43 @@ AC_DEFUN([gl_REGEX],
}
}
+ /* Test for glibc bug 20381
+ <https://sourceware.org/bugzilla/show_bug.cgi?id=20381>. */
+ if (setlocale (LC_ALL, "el_GR.iso88597")
+ || setlocale (LC_ALL, "el_GR.ISO8859-7")
+ || setlocale (LC_ALL, "el_GR.iso8859-7"))
+ {
+ /* Check this only in Greek locales that seem to be working.
+ In macOS 26, for example, setlocale (LC_ALL, "el_GR.ISO8859-7")
+ succeed but acts like the C locale. */
+ if (toupper (0xf2) == 0xd3 && toupper (0xf3) == 0xd3)
+ for (int i = 0; i < 3; i++)
+ for (int j = 0; j < 3; j++)
+ {
+ static char const str[3][2] = { "\xd3", "\xf2", "\xf3" };
+ regex_t re;
+ int err = regcomp (&re, str[i], REG_ICASE | REG_NOSUB);
+ if (err)
+ {
+ result |= 64;
+ continue;
+ }
+
+ int with = regexec (&re, str[j], 0, NULL, 0);
+ free (re.fastmap);
+ re.fastmap = NULL;
+ re.fastmap_accurate = 0;
+ int without = regexec (&re, str[j], 0, NULL, 0);
+ if (with != without)
+ result |= 64;
+
+ regfree (&re);
+ }
+
+ if (! setlocale (LC_ALL, "C"))
+ return 64;
+ }
+
#if 0
/* It would be nice to reject hosts whose regoff_t values are too
narrow (including glibc on hosts with 64-bit ptrdiff_t and
--
2.55.0