bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
* regex.m4 fails in all glibc
@ 2021-07-14 13:51 林宏雄
  2021-07-15  5:08 ` Paul Eggert
  0 siblings, 1 reply; 3+ messages in thread
From: 林宏雄 @ 2021-07-14 13:51 UTC (permalink / raw)
  To: bug-gnulib; +Cc: Jim Meyering

[-- Attachment #1: Type: text/plain, Size: 2034 bytes --]

I'm importing the regex module of Gnulib to Universal ctags.
https://github.com/universal-ctags/ctags/pull/3054

From the comment of regex.m4
    # If the system regex support is good enough that it passes the
    # following run test, then default to *not* using the included regex.c.

We expect that configure should not use the included regex.c
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.com
Date: 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 (&regex, 0, sizeof regex);
            s = re_compile_pattern ("0|()0|\\1|0", 10, &regex);
            if (!s)
              result |= 64;     // !!! FAILED HERE !!!
            else
              {
                if (strcmp (s, "Invalid back reference"))
                  result |= 64;
                regfree (&regex);
              }
            ...
-----------------------------------------

Returning 0 by re_compile_pattern() is correct behavior. It should not fail.

I'm using the lastest Gnulib.

Regards,
-- 
Hiroo Hayashi

[-- Attachment #2: Type: text/html, Size: 2886 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-07-18  8:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-14 13:51 regex.m4 fails in all glibc 林宏雄
2021-07-15  5:08 ` Paul Eggert
2021-07-18  8:53   ` Bruno Haible

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).