[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 07/10] regex: fix longstanding backref match bug
From: |
Dmitry V. Levin |
Subject: |
Re: [PATCH 07/10] regex: fix longstanding backref match bug |
Date: |
Sat, 17 Apr 2021 00:37:47 +0300 |
On Fri, Feb 05, 2021 at 05:25:59PM -0800, Paul Eggert wrote:
> This fixes a longstanding glibc bug concerning backreferences
> <https://sourceware.org/11053> (2009-12-04).
Nit: this short URL doesn't work, while the longer one does:
https://sourceware.org/bugzilla/show_bug.cgi?id=11053
> * lib/regexec.c (proceed_next_node, push_fail_stack)
> (pop_fail_stack): Push and pop the previous registers
> as well as the current ones. All callers changed.
> (set_regs): Also pop if CUR_NODE has already been checked,
> so that it does not get added as a duplicate set entry.
> (update_regs): Fix comment location.
> * tests/test-regex.c (tests): New constant.
> (bug_regex11): New test function.
> (main): Bump alarm value. Call new test function.
> ---
> ChangeLog | 13 ++++++
> lib/regexec.c | 26 +++++++----
> tests/test-regex.c | 113 ++++++++++++++++++++++++++++++++++++++++++++-
> 3 files changed, 141 insertions(+), 11 deletions(-)
Apparently, this commit changes behaviour of GNU sed in a way that looks
like regression.
When GNU sed is built with this gnulib commit (v0.1-4426-g70b673eb7):
$ echo 123 |sed -r 's/^1*+(.)/\1/'
3
$ echo 123 |sed -r 's/^(1*)*(.)/\2/'
3
When GNU sed is built with the previous gnulib commit (v0.1-4425-gf5596242f):
$ echo 123 |sed -r 's/^1*+(.)/\1/'
23
$ echo 123 |sed -r 's/^(1*)*(.)/\2/'
23
There are regexps in the wild containing "*+" that used to work before,
see e.g.
https://lore.kernel.org/lkml/20210414182723.1670663-1-vt@altlinux.org/T/#u
--
ldv
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [PATCH 07/10] regex: fix longstanding backref match bug,
Dmitry V. Levin <=