[Top][All Lists]

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

Re: Grep --directories option

From: Paul Eggert
Subject: Re: Grep --directories option
Date: 03 Jun 2003 11:05:33 -0700
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

Stepan Kasal <> writes:

> So if the fact that the file is a directory was the reason why the OS
> refused to read it, that fact is not reported.

> So now I understand that the current behaviour is good.

No, it's not good, because the behavior doesn't conform to POSIX.
POSIX requires a diagnostic, and requires that the exit status must be
greater than 1.  Here's why:

says that grep must get the contents of the file by the equivalent of
open () followed by successive read () calls.
(under CONSEQUENCES OF ERRORS) says that if the requested operation
(in this case a "read") can't be done, the utility shall issue
a diagnostic and exit with error status.

So I would change the text to this:

        [...] `read', which means that `grep' attempts to read the
        directory just as if it was an ordinary file.  Many operating
        systems and filesystems disallow this, which causes `grep' to
        report an error and go on to the next input file.

reply via email to

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