bug-grep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#20974: Weird newline matching behaviour in --null-data mode


From: Paul Eggert
Subject: bug#20974: Weird newline matching behaviour in --null-data mode
Date: Sat, 04 Jul 2015 08:50:14 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0

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.

Attachment: 0001-grep-z-.-now-consistently-matches-newline.patch
Description: Text Data

Attachment: 0002-grep-z-x-now-consistently-matches-newline.patch
Description: Text Data

Attachment: 0003-dfa-.-and-x-now-consistently-match-newline.patch
Description: Text Data

Attachment: 0004-build-update-gnulib-submodule-to-latest.patch
Description: Text Data

Attachment: 0005-maint-ignore-gendocs_template_min.patch
Description: Text Data

Attachment: 0006-grep-use-recent-gnulib-syntax-bits.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]