bug-gnulib
[Top][All Lists]
Advanced

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

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


From: Dmitry V. Levin
Subject: Re: [PATCH] regex: fix match with possessive quantifier
Date: Mon, 7 Jun 2021 00:45:02 +0300

On Wed, May 26, 2021 at 12:08:19PM +0300, Egor Ignatov wrote:
> 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 <egori@altlinux.org>
> ---
> Hi Paul,
> 
> Do you have any test cases for bug 11053(glibc) for gnulib?
> This patch fixes the issue with "*+", but I'm not sure it
> doesn't break your fix for 11053.

Thanks, the fix looks plausible, it doesn't break any tests
(including those introduced along with commit 70b673eb7),
so I've applied it now, and the following follow-up patch:

diff --git a/tests/test-regex.c b/tests/test-regex.c
index 3de6213ff..7ea73cfb6 100644
--- a/tests/test-regex.c
+++ b/tests/test-regex.c
@@ -116,6 +116,10 @@ static struct
     "level", REG_NOSUB | REG_EXTENDED, 0, { { -1, -1 } } },
   { "^(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?).?\\9\\8\\7\\6\\5\\4\\3\\2\\1$",
     "ababababa", REG_EXTENDED, 1, { { 0, 9 } } },
+  /* Test for *+ match.  */
+  { "^a*+(.)", "ab", REG_EXTENDED, 2, { { 0, 2 }, { 1, 2 } } },
+  /* Test for ** match.  */
+  { "^(a*)*(.)", "ab", REG_EXTENDED, 3, { { 0, 2 }, { 0, 1 }, { 1, 2 } } },
 };
 
 static void

-- 
ldv



reply via email to

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