[PATCH v2] regex: fix backreference matching

2021-07-09 Thread Egor Ignatov
from sed and grep have passed. Signed-off-by: Egor Ignatov --- lib/regexec.c | 15 +++ 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/regexec.c b/lib/regexec.c index 5e4eb497a..8f0f14575 100644 --- a/lib/regexec.c +++ b/lib/regexec.c @@ -1233,7 +1233,7 @@ proceed_n

Re: [PATCH] regex: fix backreference matching

2021-06-29 Thread Egor Ignatov
Well, then I have a few questions about matching and capturing groups. 1. "ab" -> "^(a*)*(.)" So, from your test case I can assume that: regs[0] = (0, 2] regs[1] = (0, 1] regs[2] = (1, 2] But if we add backref at the end: 2. "ab" -> "^(a*)*(.)\1" check_matching matches the whole string "ab", thi

Re: [PATCH] regex: fix match with possessive quantifier

2021-06-22 Thread Egor Ignatov
> regex_internal.c:1317:7: runtime error: execution reached an unreachable > program point > FAIL test-regex (exit status: 1) This problem occurs in this test: '{ "()\\1*\\1*", "", REG_EXTENDED, 2, { { 0, 0 }, { 0, 0 } } }' because proceed_next_node tries to insert an existing element into the se

[PATCH] regex: fix assertion in re_node_set_insert

2021-06-22 Thread Egor Ignatov
* lib/regexec.c (proceed_next_node): Add duplicate insertion check for eps_via_nodes set. Signed-off-by: Egor Ignatov --- lib/regexec.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/regexec.c b/lib/regexec.c index 23b984a21..c05b92783 100644 --- a/lib

[PATCH] regex: fix backreference matching

2021-06-16 Thread Egor Ignatov
-regex.c: Fix tests. Signed-off-by: Egor Ignatov --- lib/regexec.c | 12 ++-- tests/test-regex.c | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/regexec.c b/lib/regexec.c index 5d4113c9d..23b984a21 100644 --- a/lib/regexec.c +++ b/lib/regexec.c @@ -1292,9

[PATCH] regex: fix match with possessive quantifier

2021-05-26 Thread Egor Ignatov
Fix behaviour introduced in 70b673e, where regexps with possessive quantifier("*+") didn't match. * lib/regexec.c (set_regs): Pop if CUR_NODE has already been checked only when we have a fail stack. Signed-off-by: Egor Ignatov --- Hi Paul, Do you have any test cases for bug 1

Probably bug in lib/regexec.c with possessive quantifier

2021-05-25 Thread Egor Ignatov
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_optio

Probably bug in lib/regexec.c with possessive quantifier

2021-05-25 Thread Egor Ignatov
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 that introduced this behavior: 70b673eb768eb7288639cbbe4642c2912b7d204e I simplified the bug case to the following: /re_syntax_options = RE_CO