bug-grep
[Top][All Lists]
Advanced

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

Re: grep-dir test


From: Eric Blake
Subject: Re: grep-dir test
Date: Mon, 19 Dec 2011 11:09:30 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111115 Thunderbird/8.0

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   address@hidden    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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