buggrep - Bugs: bug #21199, odd output for some patterns...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #21199: odd output for some patterns combining backreference, alternation, and repetition

Submitter:  Lex Lamey <lexlamey>
Submitted:  Sun 30 Sep 2007 08:03:12 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  None
Open/Closed:  Closed

Sat 06 Feb 2010 01:17:30 PM UTC, comment #5: 

Fixed by switch to gnulib regex.



Thank you for the bug report. This bug has been fixed in the
development sources, which can be downloaded using git from
git://git.sv.gnu.org/grep.git

Paolo Bonzini <bonzini>
Fri 04 Dec 2009 12:59:41 PM UTC, comment #4: 

Reproduced with en_US.UTF-8 and --with-included-regex.  Passes with glibc regex.

Paolo Bonzini <bonzini>
Mon 01 Oct 2007 03:03:34 AM UTC, comment #3: 

As for grep instead of egrep, if I try the same commands that way, I'm told: "Invalid back reference".

Lex Lamey <lexlamey>
Mon 01 Oct 2007 02:21:56 AM UTC, comment #2: 

I'm running Darwin 8.10.1 (Mac OS X 10.4.10).  I don't believe I've altered the system in any significant way since installing the OS three months ago.  The grep I'm using is the one that came with Darwin.

Lex Lamey <lexlamey>
Sun 30 Sep 2007 09:38:04 PM UTC, comment #1: 

On what system and what distro are you seeing this?  Because here on Gentoo and Ubuntu Feisty it is behaving as expected, and even a plain grep-2.5.1 does the right thing:

$ echo 88-88 | egrep -o '([0-9])([0-9])-(\1|\2){1}'
88-8
$ echo 88-88 | egrep -o '([0-9])([0-9])-(\1|\2){2}'
88-88
$ echo 88-88 | egrep -o '([0-9])([0-9])-(\1|\2){3}'
$ echo 88-88 | egrep -o '([0-9])([0-9])-(\1|\2){4}'


$ echo 88-81 | egrep -o '([0-9])([0-9])-(\1|\2){1}'
88-8
$ echo 88-81 | egrep -o '([0-9])([0-9])-(\1|\2){2}'
$ echo 88-81 | egrep -o '([0-9])([0-9])-(\1|\2){3}'
$ echo 88-81 | egrep -o '([0-9])([0-9])-(\1|\2){4}'

Benno Schulenberg <bens>
Sun 30 Sep 2007 08:03:12 PM UTC, original submission:  

I think grep (2.5.1) is misbehaving on me.  Here are twelve examples, wherein I apply six patterns (differing only in the repetition argument) to two inputs (differing only in their fifth character).  Five of the outputs (marked '!') seem to be wrong to me.  But I'm quite new to grep so maybe I've misunderstood something.

$ echo 88-88 | egrep -o '([0-9])([0-9])-(\1|\2){1}'
88-8

$ echo 88-88 | egrep -o '([0-9])([0-9])-(\1|\2){2}'
88-88

$ echo 88-88 | egrep -o '([0-9])([0-9])-(\1|\2){3}'
88-88
    !

$ echo 88-88 | egrep -o '([0-9])([0-9])-(\1|\2){4}'
88-8
    !!

$ echo 88-88 | egrep -o '([0-9])([0-9])-(\1|\2){5}'
88-88
    !

$ echo 88-88 | egrep -o '([0-9])([0-9])-(\1|\2){6}'
88-88
    !

$ echo 88-81 | egrep -o '([0-9])([0-9])-(\1|\2){1}'
88-8

$ echo 88-81 | egrep -o '([0-9])([0-9])-(\1|\2){2}'
88-8
    !

$ echo 88-81 | egrep -o '([0-9])([0-9])-(\1|\2){3}'

$ echo 88-81 | egrep -o '([0-9])([0-9])-(\1|\2){4}'

$ echo 88-81 | egrep -o '([0-9])([0-9])-(\1|\2){5}'

$ echo 88-81 | egrep -o '([0-9])([0-9])-(\1|\2){6}'

Lex Lamey <lexlamey>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by bonzini (Posted a comment)
  • -email is unavailable- added by bens (Posted a comment)
  • -email is unavailable- added by lexlamey (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2010-02-06 bonzini StatusNone Fixed
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code