GNU bug report logs - #44352
Incorrect matches for some ERE

Previous Next

Package: grep;

Reported by: Gonzalo Padrino <grimalgon <at> gmail.com>

Date: Sat, 31 Oct 2020 16:18:01 UTC

Severity: normal

Merged with 44351

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 44352 in the body.
You can then email your comments to 44352 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-grep <at> gnu.org:
bug#44352; Package grep. (Sat, 31 Oct 2020 16:18:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Gonzalo Padrino <grimalgon <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-grep <at> gnu.org. (Sat, 31 Oct 2020 16:18:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Gonzalo Padrino <grimalgon <at> gmail.com>
To: bug-grep <at> gnu.org
Subject: Incorrect matches for some ERE
Date: Sat, 31 Oct 2020 16:26:25 +0100
[Message part 1 (text/plain, inline)]
  While using GNU grep v3.4 in an Ubuntu 20.04 userspace running on top of
Win10 WSL (yeah, i know... but also checked in other envs) i discovered
what seems like an obvious bug (if i'm not mistaken).

  The bug:
-----
me <at> host:~$  echo 'xxxxy' |grep -E '^x+x+x+x+y$'
xxxxy
me <at> host:~$  echo 'xxxy' |grep -E '^x+x+x+x+y$'
xxxy
me <at> host:~$  echo 'xxy' |grep -E '^x+x+x+x+y$'
xxy
me <at> host:~$  echo 'xy' |grep -E '^x+x+x+x+y$'

----
...the terminal supports ansi color escapes, and what's really weird is
that only the result from the first command is colored in red. First and
fourth commands yield correct results; the second and third do not, as they
should not match it's input.

  I've tested releases from v3.1 to latest v3.5 and found the anomalous
behaviour in version v3.2 through v3.5. A (quick and clunky) git bisect led
me to believe it was introduced about two years ago, possibly in commit
123620af88f55c3e0cc9f0aed7311c72f625bc82 (
https://git.savannah.gnu.org/cgit/grep.git/commit/?id=123620af88f55c3e0cc9f0aed7311c72f625bc82
).
If this is true, it would mean either the bug is in gnulib, or maybe grep
needed to do some kind of extra handling on it's side.

Kind regards. Gonzalo Padrino.

P.S.: I had to patch some things in order to successfully compile the code
after checking out some problematic commits (pragmas to avoid warnings
about "pure" and "noreturn" function attributes, a missing configmake
dependency in bootstrap.conf, etc ).

P.S.: Resending message since first got lost in aether apparently.
[Message part 2 (text/html, inline)]

Merged 44351 44352. Request was from Jim Meyering <jim <at> meyering.net> to control <at> debbugs.gnu.org. (Sat, 31 Oct 2020 18:51:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-grep <at> gnu.org:
bug#44352; Package grep. (Sat, 31 Oct 2020 18:52:01 GMT) Full text and rfc822 format available.

Message #10 received at 44352 <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: Gonzalo Padrino <grimalgon <at> gmail.com>
Cc: 44352 <at> debbugs.gnu.org
Subject: Re: bug#44352: Incorrect matches for some ERE
Date: Sat, 31 Oct 2020 11:51:29 -0700
On Sat, Oct 31, 2020 at 9:18 AM Gonzalo Padrino <grimalgon <at> gmail.com> wrote:
>   While using GNU grep v3.4 in an Ubuntu 20.04 userspace running on top of
> Win10 WSL (yeah, i know... but also checked in other envs) i discovered
> what seems like an obvious bug (if i'm not mistaken).
>
>   The bug:
> -----
> me <at> host:~$  echo 'xxxxy' |grep -E '^x+x+x+x+y$'
> xxxxy
> me <at> host:~$  echo 'xxxy' |grep -E '^x+x+x+x+y$'
> xxxy
> me <at> host:~$  echo 'xxy' |grep -E '^x+x+x+x+y$'
> xxy
> me <at> host:~$  echo 'xy' |grep -E '^x+x+x+x+y$'
>
> ----
> ...the terminal supports ansi color escapes, and what's really weird is
> that only the result from the first command is colored in red. First and
> fourth commands yield correct results; the second and third do not, as they
> should not match it's input.
>
>   I've tested releases from v3.1 to latest v3.5 and found the anomalous
> behaviour in version v3.2 through v3.5. A (quick and clunky) git bisect led
> me to believe it was introduced about two years ago, possibly in commit
> 123620af88f55c3e0cc9f0aed7311c72f625bc82 (
> https://git.savannah.gnu.org/cgit/grep.git/commit/?id=123620af88f55c3e0cc9f0aed7311c72f625bc82
> ).
> If this is true, it would mean either the bug is in gnulib, or maybe grep
> needed to do some kind of extra handling on it's side.
>
> Kind regards. Gonzalo Padrino.
>
> P.S.: I had to patch some things in order to successfully compile the code
> after checking out some problematic commits (pragmas to avoid warnings
> about "pure" and "noreturn" function attributes, a missing configmake
> dependency in bootstrap.conf, etc ).
>
> P.S.: Resending message since first got lost in aether apparently.

Thanks. It was not lost. Conversation is continuing on
https://bugs.gnu.org/44351




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 30 Nov 2020 12:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 260 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.