Subject: bug#15483: POSIXLY_CORRECT documentation vis a vis some simple EREs

From: Eric Blake <[email-masked]>
Date: Mon, 30 Sep 2013 11:32:07 -0600

On 09/30/2013 08:21 AM, Eric Blake wrote:

> Case in point: have you ever typed 'grep --help' to see what grep can
> do, or 'grep --version' to see what build you are using?  Well, such a
> command line is not permissible of a strictly conforming use of grep
> (ie. POSIX states that it is undefined behavior to pass a command line
> argument that has a length larger than 2 and which starts with two
> dashes).

Since we're playing the role of pedantry here, let me amend that:

POSIX states that it is undefined behavior to pass a command line
argument that has a length larger than 2 and which starts with two
dashes, IFF you did not first pass the '--' end-of-options argument.
(The behavior of 'grep -- --help' is well-defined: search for lines of
stdin that match the regular expression "--help".)

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org