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

Submitted by:  Lex Lamey <lexlamey>
Submitted on:  Sun 30 Sep 2007 08:03:12 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned 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>

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 06 Feb 2010 01:17:30 PM UTCbonziniStatusNone=>Fixed
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1