buggrep - Bugs: bug #37737, Contained subexpressions don't...


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

bug #37737: Contained subexpressions don't follow POSIX

Submitted by:  Роман Донченко <rdonch>
Submitted on:  Wed Nov 14 21:26:45 2012  
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: None
Privacy: PublicAssigned to: None
Open/Closed: Open

Thu Jul 4 17:13:13 2013, comment #4:

I was reporting it as a violation. Though, POSIX-mandated behavior does make slightly more sense to me than the current behavior.

Роман Донченко <rdonch>
Thu Jul 4 07:14:41 2013, comment #3:

Roman, are you encountering this problem in a real-world usecase, or are you simply reporting a violation of the standard?

Paolo Bonzini <bonzini>
Thu Nov 15 17:29:23 2012, comment #2:

Looks like this is pretty much the same bug as <http://sourceware.org/bugzilla/show_bug.cgi?id=52>.

Роман Донченко <rdonch>
Wed Nov 14 21:31:06 2012, comment #1:

Sorry, markup processor mangled the pattern. This should be correct:

Роман Донченко <rdonch>
Wed Nov 14 21:26:45 2012, original submission:

Here's what POSIX says <http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html>:

9.3.6 BREs Matching Multiple Characters

<...> The string matched by a contained subexpression shall be within the string matched by the containing subexpression. If the containing subexpression does not match, or if there is no match for the contained subexpression within the string matched by the containing subexpression, then back-reference expressions corresponding to the contained subexpression shall not match. <...> For example, <...> the expression "\(a\(b\)\)\2" fails to match 'abab' <...> .

And yet...

$ src/grep '\(a\(b\)\)\2' <<< 'abab'

I'm guessing that it assumes that \1 covers character #3, but \2 covers character #2, which is against the spec.

Роман Донченко <rdonch>


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 rdonch (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):



    No Changes Have Been Made to This Item

    Back to the top

    Powered by Savane 3.1-cleanup1