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

--- Comment #2 from commit-h...@freebsd.org ---
A commit in branch main references this bug:

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

commit f823c6dc730b0dd08b54a53be1d8fd587eee7021
Author:     Kyle Evans <kev...@freebsd.org>
AuthorDate: 2021-02-04 21:26:45 +0000
Commit:     Kyle Evans <kev...@freebsd.org>
CommitDate: 2021-02-05 02:59:42 +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
    MFC-after:      4 days

 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.
_______________________________________________
freebsd-bugs@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"

Reply via email to