|
From: | Julian Foad |
Subject: | Re: grep . /; echo $? |
Date: | Tue, 25 Oct 2005 13:32:47 +0100 |
User-agent: | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050511 |
Charles Levert wrote:
According to the grep(1p) POSIX "man page":
[...]
This does not restrict GNU grep from being more informative about what happened by documenting and using many exit statuses that are greater than 1 (e.g., open() error vs. read() error),
Sure, but that's not relevant to this thread as far as I can see. This thread is about whether to exit with an error, not about how detailed any such error should be.
`--directories=ACTION' If an input file is a directory, use ACTION to process it. By default, ACTION is `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).I don't know: it all seems a bit arbitrary and inconsistent. What's the point of defaulting to ACTION="read" on systems that don't support it?Consistency (for grep) across OSes. If OSes are inconsistent, that is another issue; grep should merely use its exit status to document what actually happened at a lower level on the OS on which it happens to be running.
So let me be clear. You disagree with the current behaviour of silently skipping unreadable directories on some systems. The default should remain "directories=read", and Grep should (on all systems) report an error if it can't read a directory that it has been told to search in, and we should remove the words "or silently skip them" from the "info" quote above. Yes?
That is fine with me. I would call this "removing unnecessary complexity". I have a niggling feeling that somebody made a conscious effort to make it behave the way it does; but that's the way of things: if a special case was introduced for some reason but the reason wasn't documented, we can't be expected to preserve it indefinitely.
- Julian
[Prev in Thread] | Current Thread | [Next in Thread] |