GNU bug report logs - #20974
Weird newline matching behaviour in --null-data mode

Previous Next

Package: grep;

Reported by: Balazs Kezes <rlblaster <at> gmail.com>

Date: Fri, 3 Jul 2015 17:00:07 UTC

Severity: normal

Done: Jim Meyering <jim <at> meyering.net>

Bug is archived. No further changes may be made.

Full log


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

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Norihiro Tanaka <noritnk <at> kcn.ne.jp>, 20974 <at> debbugs.gnu.org, 
 jim <at> meyering.net, rlblaster <at> gmail.com
Subject: Re: bug#20974: Weird newline matching behaviour in --null-data mode
Date: Sat, 04 Jul 2015 08:50:14 -0700
[Message part 1 (text/plain, inline)]
Norihiro Tanaka wrote:
> Not only '.' but also hat
> list (e.g. [^a]) should match newline with -z.  So we need clear
> RE_HAT_LISTS_NOT_NEWLINE bit.

Thanks for reporting that.  I also noticed some related bugs in dfa.c that 
'grep' does not exercise (so no grep test cases, alas).  Plus, it's long been 
time that we fix RE_SYNTAX_GREP and RE_SYNTAX_EGREP to match grep's actual 
behavior.  So I installed a Gnulib patch to update RE_SYNTAX_GREP and 
RE_SYNTAX_EGREP to the fixed behavior (see 
<http://lists.gnu.org/archive/html/bug-gnulib/2015-07/msg00016.html>) and 
installed grep patches to sync to gnulib and fix the other problems.

The first attached patch I installed yesterday (and you've commented on it) but 
I didn't have time to send email about it so am attaching it now.  The other 
five attached patches fix the bugs noted above.

Here's the justification for the first attached patch.  The grep documentation 
says that '.' matches any character, and this includes both NUL and LF. 
Ordinarily, LF terminates a line and so is never part of match data, but '.' 
should still match NUL.  Conversely with -z, NUL terminates a line and so is 
never part of match data, but '.' should still match LF.

[0001-grep-z-.-now-consistently-matches-newline.patch (text/x-diff, attachment)]
[0002-grep-z-x-now-consistently-matches-newline.patch (text/x-diff, attachment)]
[0003-dfa-.-and-x-now-consistently-match-newline.patch (text/x-diff, attachment)]
[0004-build-update-gnulib-submodule-to-latest.patch (text/x-diff, attachment)]
[0005-maint-ignore-gendocs_template_min.patch (text/x-diff, attachment)]
[0006-grep-use-recent-gnulib-syntax-bits.patch (text/x-diff, attachment)]

This bug report was last modified 9 years and 328 days ago.

Previous Next


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