bug-gnulib
[Top][All Lists]
Advanced

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

Probably bug in lib/regexec.c with possessive quantifier


From: Egor Ignatov
Subject: Probably bug in lib/regexec.c with possessive quantifier
Date: Tue, 25 May 2021 12:33:06 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.2

Hi,

So, after updating gnulib, some test cases in augeas(https://github.com/hercules-team/augeas) related to regex started to fail.
I found a commit in gnulib that introduced this behavior:

70b673eb768eb7288639cbbe4642c2912b7d204e

I simplified the bug case to the following:

re_syntax_options = RE_NO_BK_PARENS;
pattern = "(.*+)";

text = "EXAMPLE";

And here is what I get in the regs after I run re_match:
match result: 'EXAMPLE'
regs[0]='EXAMPLE'(0,7)
regs[1]='EXAMPLE'(0,-1)
regs[2]=''(-1,-1)

But in the previous versions (before commit specified earlier) I would get:
match result: 'EXAMPLE'
regs[0]='EXAMPLE'(0,7)
regs[1]='EXAMPLE'(0,7)
regs[2]=''(-1,-1)

As you can see, in the first case regs[1] does not point to the first group.
However, everything works fine if I remove a possessive quantifier from the pattern.
Is this intentional behavior or is it a bug?

Thank you
-- 
Egor

reply via email to

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