Hi Collin,

> Not sure how this didn't get found sooner, to be honest. Here is an
> example of the bug:
> 
>     $ git clone https://git.savannah.gnu.org/git/rcs.git
>     $ cd rcs
>     $ git checkout next
>     $ sh -x autogen.sh

Thanks for this recipe. I think this is worth a unit test, since it
is a special case that is otherwise not tested.

> I've applied this patch fixing it and confirmed it passes with
> GNULIB_TOOL_IMPL=sh+py.

The regular expression doesn't seem right:

>>> import re
>>> re.search(re.compile(r'^ACLOCAL_AMFLAGS[\t ]*=[\t ]*([^#]+?)$', 
>>> re.MULTILINE), '')
>>> re.search(re.compile(r'^ACLOCAL_AMFLAGS[\t ]*=[\t ]*([^#]+?)$', 
>>> re.MULTILINE), 'ACLOCAL_AMFLAGS = -I m4')
<re.Match object; span=(0, 23), match='ACLOCAL_AMFLAGS = -I m4'>
>>> re.search(re.compile(r'^ACLOCAL_AMFLAGS[\t ]*=[\t ]*([^#]+?)$', 
>>> re.MULTILINE), 'ACLOCAL_AMFLAGS = -I m4 # yes')

The point of using a non-greedy operator is to not include newlines
in the match, right? So,
  re.compile(r'^ACLOCAL_AMFLAGS[\t ]*=[\t ]*([^#]*)', re.MULTILINE)
wouldn't work?

Bruno




Reply via email to