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

 
 

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

bug #37737: Contained subexpressions don't follow POSIX

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

Thu 04 Jul 2013 05:13:13 PM UTC, 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 04 Jul 2013 07:14:41 AM UTC, 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 15 Nov 2012 05:29:23 PM UTC, comment #2:

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

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

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

Роман Донченко <rdonch>
Wed 14 Nov 2012 09:26:45 PM UTC, 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'
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-cleanup