I'm importing the regex module of Gnulib to Universal ctags.
on the system with up-to-date glibc.
But we found it used the included regex.c even in (at least) glibc-2.31 and glibc-2.33.
The test added by the following commit fails.
commit 55a4abd92a0a8fa0a9d9aff3892505f7b0c6d73c
Author: Jim Meyering
meyering@fb.comDate: Sat Dec 15 15:24:21 2018 -0800
regex: work around a bug in glibc-2.27 and prior
* m4/regex.m4 (gl_REGEX): Reject any system regexp that gets a failed
assertion for /0|()0|\1|0/.
* tests/test-regex.c (main): Add the same test here.
...
-----------------------------------------
It should fails in glibc-2.27 and prior, but it fails in all glibc, if I understand correctly.
Here is the test fails.
-----------------------------------------
...
/* Matching with the compiled form of this regexp would provoke
an assertion failure prior to glibc-2.28:
regexec.c:1375: pop_fail_stack: Assertion 'num >= 0' failed
With glibc-2.28, compilation fails and reports the invalid
back reference. */
re_set_syntax (RE_SYNTAX_POSIX_EGREP);
memset (®ex, 0, sizeof regex);
s = re_compile_pattern ("0|()0|\\1|0", 10, ®ex);
if (!s)
result |= 64; // !!! FAILED HERE !!!
else
{
if (strcmp (s, "Invalid back reference"))
result |= 64;
regfree (®ex);
}
...
-----------------------------------------
Returning 0 by re_compile_pattern() is correct behavior. It should not fail.
I'm using the lastest Gnulib.
Regards,
--
Hiroo Hayashi