Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Feb 2021 15:12:52 +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-KPOKKcZ5Os@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-253209-227@https.bugs.freebsd.org/bugzilla/>
References:  <bug-253209-227@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D253209

--- Comment #4 from commit-hook@FreeBSD.org ---
A commit in branch releng/13.0 references this bug:

URL:
https://cgit.FreeBSD.org/src/commit/?id=3Df28ccd8d95954134cec93db482fb0bd4c=
e93f36e

commit f28ccd8d95954134cec93db482fb0bd4ce93f36e
Author:     Kyle Evans <kevans@FreeBSD.org>
AuthorDate: 2021-02-11 15:10:44 +0000
Commit:     Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2021-02-11 15:12:10 +0000

    grep: fix null pattern and empty pattern file behavior

    The null pattern semantics were terrible because I tried to match gnugr=
ep,
    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 patter=
ns
    are specified. In any other case, we will continue processing other
    patterns.  If no other patterns are specified beside a null pattern, th=
en
    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 t=
he
    null pattern does 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
    Approved by:    re (gjb)

    (cherry picked from commit f823c6dc730b0dd08b54a53be1d8fd587eee7021)
    (cherry picked from commit 574d0dfae5011a766aa967f1d1675ddf7b535936)

 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(-)

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



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