help-hurd
[Top][All Lists]
Advanced

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

Re: Grep --directories option (POSIX)


From: Stepan Kasal
Subject: Re: Grep --directories option (POSIX)
Date: Mon, 2 Jun 2003 10:05:27 +0200
User-agent: Mutt/1.2.5.1i

Hello,
        I haven't read whole thread yet, but I hope the following question
is not misleaded:

On Fri, May 30, 2003 at 05:32:06PM -0700, Paul Eggert wrote:
> [...] As I read it, POSIX requires
> that "grep foo dir" must work if one can read dir as if it were a
> file, and if the resulting bytes are the bytes of a text file.  It
> also requires that 'grep' must output a diagnostic and must fail
> (i.e. exit with status 2) if the 'read' fails.

Understanding what POSIX says is really crucial for this issue.

The definition of grep utility says, among other things:

|    INPUT FILES
|
|     The input files shall be text files.

(http://www.opengroup.org/onlinepubs/007904975/utilities/grep.html)

Looking for what ``shall'' means:

|    shall
|
|   For an implementation [...]
|
|   For an application or user, describes a behavior that is mandatory.

http://www.opengroup.org/onlinepubs/007904975/basedefs/xbd_chap01.html#tag_01_04_05

I understand this that it's mandatory for the user to supply
``text file'' as the arguments.

I can also cite this:

|  Text File
|
|   [...] many utilities only produce predictable or meaningful output when
|   operating  on text files. The standard utilities that have such
|   restrictions always specify "text files" in their STDIN or INPUT FILES
|   sections.

http://www.opengroup.org/onlinepubs/007904975/basedefs/xbd_chap03.html#tag_03_392

So it seems that grep is one of these utilities.

If I were true, grep could do anything as soon as someone supplies a
non-text file.  Thus --directories=skip would be legal on most systems.

The exception are sytems where a file can be ``text file'' and directory
at once.  (I haven't heard about any such system except GNU/Hurd.)

Looking forward to your comments,
        Stepan Kasal




reply via email to

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