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

Submitter:  Роман Донченко <rdonch>
Submitted:  Wed 14 Nov 2012 09:26:45 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  None
Privacy:  Public Assigned 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:


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


Роман Донченко <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>

 

(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 rdonch (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.

     

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.13-cf05.
    Corresponding source code