[Top][All Lists]

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

Re: Grep --directories option

From: Stepan Kasal
Subject: Re: Grep --directories option
Date: Tue, 3 Jun 2003 13:32:37 +0200
User-agent: Mutt/

Hallo again,

On Mon, Jun 02, 2003 at 12:38:44PM -0700, Paul Eggert wrote:
> And if a Hurd system is exporting a directory to Solaris
> via NFS or CIFS, the Solaris 'grep' will indeed see a directory that
> is a text file.

OK, I'm convinced now that ``read'' must be the default.

I have also discovered that I misunderstood the code I've cited
several times:

|   if (! fillbuf (save, stats))
|       if (! is_EISDIR (errno, file) && ! suppress_errors)
|         error (filename, errno);

if -s is not given, the only error which is concealed is EISDIR
or ``Is a directory''.

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.

The only thing which should be fixed is the documentation.
The info page says:
        [...] `read', which means that directories are read
     just as if they were ordinary files (some operating systems and
     filesystems disallow this, and will cause `grep' to print error
     messages for every directory or silently skip them).

In fact, grep tries hard to be silent about such errors, so I'd just say:

        [...] `read', which means that `grep' attempts to read the
        directory just as if it was an ordinary file.  Most operating
        systems and filesystems disallow this, which causes `grep' to
        silently skip the directory.

(The man page should be fixed in a similar manner.)

Would you agree with this?

Stepan Kasal

reply via email to

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