bug-automake
[Top][All Lists]
Advanced

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

bug#7434: When an incorrect option is used before --help/--version, auto


From: Eric Blake
Subject: bug#7434: When an incorrect option is used before --help/--version, automake behaviour is inconsistent with that of other GNU programs.
Date: Thu, 18 Nov 2010 08:55:39 -0700
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.12) Gecko/20101103 Fedora/1.0-0.33.b2pre.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.6

On 11/18/2010 08:22 AM, Stefano Lattarini wrote:
> Severity: wishlist
> 
> Currently, automake and aclocal scan their command line looking for
> `--help' and `--version' even after an invalid option has been seen;
> and in case one of those two options is seen, it takes precedence
> even over error reporting about preceding invalid options.

GNU Coding Standards _only_ require that --help and --version be
recognized as the first argument, with no other arguments.  When
possible, recognizing --help and --version after other arguments, or
with other arguments afterwards, is nice, but there are no rules that
require that consistency.

> 
> But this is inconsistent with the behaviour of many others GNU/free
> programs; for example:
> 
>   $ m4 --version --no-such-option; echo \$? = $?
>   m4 (GNU M4) 1.4.14
>   $? = 0
> 
>   $ m4 --no-such-option --version; echo \$? = $?
>   m4: unrecognized option '--no-such-option'
>   Try `m4 --help' for more information.
>   $? = 1

m4 makes a single pass through its options, and gives up on the first
error (after all, how do we know that a future version of m4 might start
accepting 'm4 --do-this=--version', where --version is the argument of
the new --do-this option, at which point 'm4 --do-this --version' would
suddenly change behavior from printing versions to instead doing this).

Coreutils is also an interesting case study, as there are several idioms
used depending on POSIX restrictions on the utility in question.

For example:

$ /usr/bin/[ --help | head -n1
Usage: test EXPRESSION
$ /usr/bin/[ --help --oops
/usr/bin/[: missing `]'
$ /usr/bin/[ --oops --help
/usr/bin/[: missing `]'


> In conclusion: would you agree with a patch that converts automake and
> aclocal to the same cmdline-scanning behaviour of the majority of other
> GNU tools?  Such a patch would also have the advantage of *simplifying*
> the current code for command line parsing in automake and aclocal.

Not necessarily on the grounds of making things match other tools, but
definitely on the grounds of having simpler code that still complies
with GCS.

-- 
Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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