bug-grep
[Top][All Lists]
Advanced

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

bug#37716: grep exit status with -L redirected to /dev/null


From: Paul Jackson
Subject: bug#37716: grep exit status with -L redirected to /dev/null
Date: Sat, 12 Oct 2019 17:29:57 -0500
User-agent: Cyrus-JMAP/3.1.7-360-g7dda896-fmstable-20191004v2

This also happens when doing "grep -L" for something
that -is- in the file, redirected to /dev/null:

======

$ echo hello > thing
$ grep -L hello thing; echo $?
1
$ grep -L hello thing > /dev/null; echo $?
0

=======

My first guess, after a minute glancing at the code, and after
using strace to notice  that grep doesn't even try to invoke
a "write(2)" system call in these examples, if it notices that
its output is redirected to /dev/null, is that the exit status
of the grep command depends sometimes, somehow,  on
whether or not it decided to write out any results at all.

My strace observations in the previous paragraph are probably
reliable.  My guess as to the logic grep is using to determine
it's process exit status are probably not reliable.

-- 
                Paul Jackson
                address@hidden





reply via email to

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