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

From: "Paul Jackson" <[email-masked]>
Date: Thu, 04 Jun 2020 00:21:15 -0500

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
                [email-masked]