[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] regex: Add extra escapes to regular expressions in m4
From: |
Eric Blake |
Subject: |
Re: [PATCH] regex: Add extra escapes to regular expressions in m4 |
Date: |
Tue, 29 Jan 2019 14:18:24 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 |
On 1/29/19 12:57 PM, Siddhesh Poyarekar wrote:
> From: Siddhesh Poyarekar <address@hidden>
>
> * m4/regex.m4 (gl_REGEX): Add extra escape characters to
> regular expressions.
> ---
>
> The m4 preprocessor eats up half the escape characters, so give it twice
> as much. I ran into this when running tests for glibc 2.29 release and
> verified that this patch fixes the problem.
Which versions of m4 and autoconf are you seeing this under? Can you
show actual snippets from the generated configure file showing that \
was eaten? And why are you only touching some of the lines, rather than
all places where \\ appears in the regex.m4 file? This fix feels fishy,
and I seriously doubt that escape characters are being eaten by m4, but
I would like to make sure we have a real root cause understanding what
prompted this patch.
> +++ b/m4/regex.m4
> @@ -204,7 +204,7 @@ AC_DEFUN([gl_REGEX],
> & ~RE_CONTEXT_INVALID_DUP
> & ~RE_NO_EMPTY_RANGES);
> memset (®ex, 0, sizeof regex);
> - s = re_compile_pattern ("[[:alnum:]_-]\\\\+$", 16, ®ex);
> + s = re_compile_pattern ("[[:alnum:]_-]\\\\\\\\+$", 16, ®ex);
> if (s)
> result |= 32;
For example, if I take coreutils.git, and using the Fedora 29 pre-built
m4-1.4.18-9.fc29.x86_64 and autoconf-2.69-28.fc29.noarch, I see the
following in the resulting configure (without your patch applied):
$ grep -A2 're_compile.*alnum' gnulib/m4/regex.m4 configure
gnulib/m4/regex.m4: s = re_compile_pattern
("[[:alnum:]_-]\\\\+$", 16, ®ex);
gnulib/m4/regex.m4- if (s)
gnulib/m4/regex.m4- result |= 32;
--
configure: s = re_compile_pattern ("[[:alnum:]_-]\\\\+$", 16,
®ex);
configure- if (s)
configure- result |= 32;
which is identical (no \ eaten), so I'm not sure why you are seeing
problems.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature