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

 
 

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

bug #27669: issue using ^ with -z

Submitter:  Peter Jakobi <jakobi>
Submitted:  Sun 11 Oct 2009 03:12:00 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  In Progress
Privacy:  Public Assigned 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>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

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

 

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

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2011-06-28 bonzini Attached File- Added p1.patch, #23580
        StatusNone In Progress

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code