Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Feb 2021 15:21:56 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 253209] grep -v -f some-empty-file -- does the wrong thing
Message-ID:  <bug-253209-227-v8UveBZBDB@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-253209-227@https.bugs.freebsd.org/bugzilla/>

index | next in thread | previous in thread | raw e-mail

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=253209

--- Comment #5 from commit-hook@FreeBSD.org ---
A commit in branch stable/12 references this bug:

URL:
https://cgit.FreeBSD.org/src/commit/?id=92ddb6090b0c5091a64855a514676a452c10750c

commit 92ddb6090b0c5091a64855a514676a452c10750c
Author:     Kyle Evans <kevans@FreeBSD.org>
AuthorDate: 2021-02-04 21:26:45 +0000
Commit:     Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2021-02-11 15:19:26 +0000

    grep: fix null pattern and empty pattern file behavior

    The null pattern semantics were terrible because I tried to match gnugrep,
    but I got it wrong.  Let's unwind that:

    - The null pattern should match every line if neither -w nor -x.
    - The null pattern should match empty lines if -x.
    - The null pattern should not match any lines if -w.

    The first two will stop processing (shortcut) even if additional patterns
    are specified. In any other case, we will continue processing other
    patterns.  If no other patterns are specified beside a null pattern, then
    we match if neither -w nor -x or set and do not match if either of those
    are specified.

    The justification for -w is that it should match on a whole word, but the
    null pattern deos not have a whole word to match on.

    Empty pattern files should never match anything, and more importantly, -v
    should cause everything to be written.

    PR:             253209

    (cherry picked from commit f823c6dc730b0dd08b54a53be1d8fd587eee7021)

 contrib/netbsd-tests/usr.bin/grep/t_grep.sh | 22 +++++++++++++++---
 usr.bin/grep/grep.c                         | 11 ---------
 usr.bin/grep/util.c                         | 35 +++++++++++++----------------
 3 files changed, 35 insertions(+), 33 deletions(-)

-- 
You are receiving this mail because:
You are on the CC list for the bug.

help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-253209-227-v8UveBZBDB>