The Grep test suite includes the grep-dir test, which does this:
mkdir a || framework_failure
echo x | grep -f a/; { test $? -gt 1 && test $? -lt 128; } || fail=1
echo x | grep -if a/; { test $? -gt 1 && test $? -lt 128; } || fail=1
echo x | grep -Ff a/; { test $? -gt 1 && test $? -lt 128; } || fail=1
echo x | grep -Fif a/; { test $? -gt 1 && test $? -lt 128; } || fail=1
If this is intended to test the behavior with a zero-size input file,
then why does it use an empty directory and not an empty file? Would
using an empty file fail to test some aspect of the Grep behavior?
The problem with "-f a/" is that on some systems (Windows), one cannot
fopen a directory. So this test fails on those systems for no good
reason, AFAICS.
(Please CC me on the responses, as I'm not subscribed to this list.)
TIA