bug-grep
[Top][All Lists]
Advanced

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

bug#41700: grep -v always exiting with 1 for empty file


From: Paul Jackson
Subject: bug#41700: grep -v always exiting with 1 for empty file
Date: Thu, 04 Jun 2020 00:21:15 -0500
User-agent: Cyrus-JMAP/3.3.0-dev0-519-g0f677ba-fm-20200601.001-g0f677ba6

If I am reading the grep.c code correctly,
asking grep to read a zero length file,
such as:

    grep foo /dev/null

causes the code to quit, with a non-zero
exit status, fairly early on, as soon as the
first call to "fillbuf()" returns with 0 bytes read.

This seems to apply except in the case of
grep -L (list files not matching) which special
cases the exit status to enable listing an
empty file as non-matching.

Being a crusty old codger, I'd recommend
changing the grep(1) man page to match
the current behavior, as observed by Andi
and myself, rather than changing the code
to be consistent with what Andi, reasonably
enough, expected.

Every time any little detail like this changes,
somebody's code breaks quietly in the night.

However since I'm not volunteering to submit
the documentation (or code) patch, my vote
counts for little :).

Carry on.

-- 
                Paul Jackson
                pj@usa.net





reply via email to

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