GNU bug report logs - #21670
surprising bug in grep -e with anchors

Previous Next

Package: grep;

Reported by: greg boyd <gboyd.ccsf <at> gmail.com>

Date: Sun, 11 Oct 2015 23:57:02 UTC

Severity: normal

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

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: greg boyd <gboyd.ccsf <at> gmail.com>
Subject: bug#21670: closed (Re: bug#21670: surprising bug in grep -e with
 anchors)
Date: Mon, 12 Oct 2015 04:35:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#21670: surprising bug in grep -e with anchors

which was filed against the grep package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 21670 <at> debbugs.gnu.org.

-- 
21670: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=21670
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Paul Eggert <eggert <at> cs.ucla.edu>
To: greg boyd <gboyd.ccsf <at> gmail.com>
Cc: Norihiro Tanaka <noritnk <at> kcn.ne.jp>, 21670-done <at> debbugs.gnu.org
Subject: Re: bug#21670: surprising bug in grep -e with anchors
Date: Sun, 11 Oct 2015 21:34:05 -0700
[Message part 3 (text/plain, inline)]
greg boyd wrote:
> test case (single line)
> abchelloabc
>
> grep does not find the line with grep -e '^hello'  nor with grep -e 'hello$'
> however, the line is output with
> grep -e '^hello' -e 'hello$'

Oooo, that's a good one.  Give your student extra credit!  As it happens, the 
bug was recently fixed by this patch by Norihiro Tanaka:

http://git.savannah.gnu.org/cgit/grep.git/commit/?id=256a4b494fe1c48083ba73b4f62607234e4fefd5

and the fix should appear in the next grep release.  However, since the patch 
was supposed to affect only performance, it appears that the bug fix was due to 
luck, and I'm taking the liberty of adding your student's test case by 
installing the attached further patch, to help prevent this bug from coming back 
in a future version.
[0001-tests-add-test-case-for-Bug-21670.patch (text/plain, attachment)]
[Message part 5 (message/rfc822, inline)]
From: greg boyd <gboyd.ccsf <at> gmail.com>
To: bug-grep <at> gnu.org, greg boyd <gboyd.ccsf <at> gmail.com>
Subject: surprising bug in grep -e with anchors
Date: Sun, 11 Oct 2015 14:01:07 -0700
[Message part 6 (text/plain, inline)]
This bug appears in GNU grep version 2.20. It is not present in the older
version I have installed on a home system (2.6.3.)

test case (single line)
abchelloabc

grep does not find the line with grep -e '^hello'  nor with grep -e 'hello$'
however, the line is output with
grep -e '^hello' -e 'hello$'

I downloaded, built and tested the bug on GNU grep 2.21 and it still
appears.

weird.

(this was found by an introductory Linux student. )

-- 
-- greg
gboyd <at> ccsf.edu
Instructor, Computer Science
http://fog.ccsf.edu/~gboyd
[Message part 7 (text/html, inline)]

This bug report was last modified 9 years and 250 days ago.

Previous Next


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