On 12/19/2011 10:21 AM, Eli Zaretskii wrote:
> 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.
Gnulib is able to emulate fopen(".", "r") with sane semantics on mingw
(by opening the null device under the hood, so that any actual fread()
of the FILE* will return immediate EOF); but it looks like grep is not
using that gnulib module.
--
Eric Blake [email protected] +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
