GNU bug report logs - #22655
grep-2.21 (and git master): --null-data and ranges work in an odd way (-P works fine)

Previous Next

Package: grep;

Reported by: Sergei Trofimovich <slyfox <at> gentoo.org>

Date: Sat, 13 Feb 2016 23:24:01 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


Message #85 received at 22655 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Stephane Chazelas <stephane.chazelas <at> gmail.com>
Cc: 22655 <at> debbugs.gnu.org
Subject: Re: bug#22655: grep -Pz '^' now fails!
Date: Sat, 19 Nov 2016 00:36:12 -0800
[Message part 1 (text/plain, inline)]
Stephane Chazelas wrote:
> one can
> use (?m) if he wants ^ to match the beginning of each line in
> the NUL-delimited record instead of just the beginning of the
> record.

I think the intent is that ^ and $ should match only the line-terminator 
specified by -z (or by -z's absence). So the sort of usage you describe is 
unspecified and not supported. That being said, it does make sense to match 
tricky regular expressions like that line by line, even if this hurts 
performance. Otherwise, I suspect there are even trickier regular expressions 
that could reject a buffer full of lines even though it contains matching lines. 
When in doubt we should avoid optimization so I installed the attached patch 
into the master branch. Please give it a try.
[0001-grep-Pz-no-longer-rejects.patch (text/x-diff, attachment)]

This bug report was last modified 8 years and 190 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.