buggrep - Bugs: bug #27669, issue using ^ with -z

 
 

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

bug #27669: issue using ^ with -z

Submitted by:  Peter Jakobi <jakobi>
Submitted on:  Sun 11 Oct 2009 03:12:00 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: In Progress
Privacy: PublicAssigned to: None
Open/Closed: Open

Tue 28 Jun 2011 09:22:49 AM UTC, comment #2:

This looks like it was fixed recently, but only in the case when the DFA matcher is used:

$ perl -e '@a=qw/abc def ghi/; foreach(@a){print "$_\n\0"}' | grep -z ^d[e-g]f
$ perl -e '@a=qw/abc def ghi/; foreach(@a){print "$_\n\0"}' | grep -z ^def
def

For glibc we would probably need a new syntax bit, RE_NULL_NEWLINE.

While doing that, and for the sake of consistency, I'm also tempted to make ^ and $ match newlines in the middle of the NULL-separated record; \` and \' would still be available to match beginning and ending of record. This is a partial patch that implements this in dfa.c.

(file #23580)

Paolo Bonzini <bonzini>
Sat 06 Mar 2010 09:19:06 AM UTC, comment #1:

As a workaround you can use \` instead of ^

Paolo Bonzini <bonzini>
Sun 11 Oct 2009 03:12:00 PM UTC, original submission:

Please verify these cases to work both with the unmodified most recent source:

perl -e '@a=qw/abc def ghi/; foreach(@a){print "$_\n"}' | grep ^def
prints def\n - OK

perl -e '@a=qw/abc def ghi/; foreach(@a){print "$_\0"}' | grep -z ^def

prints NOTHING. FAIL. grep -z -x 'def.*' however works.

This failure is IMHO a critical error, as the -z option is probably frequently used for backups and system admin scripts.

grep 2.5.3, Ubuntu jaunty amd64 (2.5.3~dfsg-6ubuntu1; the error might be recently introduced (downstream issue?) as I haven't observed it before)

LANG=en_US.UTF-8, no LC* being set yet.

Thanx,
Peter.

Peter Jakobi <jakobi>

 

Attached Files
file #23580:  p1.patch added by bonzini (4kB - text/x-patch)

 

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 jakobi (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
    Tue 28 Jun 2011 09:22:49 AM UTCbonziniAttached File-=>Added p1.patch, #23580
      StatusNone=>In Progress

    Back to the top


    Powered by Savane 3.1-cleanup