[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

regex.m4 fails in all glibc

From: 林宏雄
Subject: regex.m4 fails in all glibc
Date: Wed, 14 Jul 2021 22:51:05 +0900

I'm importing the regex module of Gnulib to Universal ctags.

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 !!!
                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.

Hiroo Hayashi

reply via email to

[Prev in Thread] Current Thread [Next in Thread]