[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bug with 'test'
From: |
Eric Blake |
Subject: |
Re: bug with 'test' |
Date: |
Fri, 09 Dec 2005 06:20:06 -0700 |
User-agent: |
Mozilla Thunderbird 1.0.2 (Windows/20050317) |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
You broke threading again. Usually on mailing lists, you want to hit
reply-to-all instead of reply.
According to The Wanderer on 12/8/2005 11:55 PM:
>>
>> Almost. POSIX requires "test --help" and "[ --help ]" both to exit
>> silently with status 0 (success), since they are non-zero length
>> one-argument expressions.
>
>
> ...then the comment in the source, immediately above the place where the
> usage message is printed, appears to be wrong. I quote:
>
> ==
> /* Recognize --help or --version, but only when invoked in the
> "[" form, and when the last argument is not "]". POSIX
> allows "[ --help" and "[ --version" to have the usual GNU
> behavior, but it requires "test --help" and "test --version"
> to exit silently with status 1. */
> ==
Patched thusly:
2005-12-09 Eric Blake <address@hidden>
* src/test.c (main): Fix misleading comment.
>
> As it happened, I had also tried '[ ] ] --help', and got the same
> message - but presumably this can be explained in the same way. It
> somehow seems a little weird that such fundamental programs don't permit
> options to come in 'any place which isn't nonsensical', but I'll admit
> that I don't see any way they could do that and still be as useful in
> the ways in which they are...
POSIX mandates some non-typical behavior on several of the coreutils; for
example "echo --" must print "--" instead of ignoring it, or "printf %s
- --help" must print "--help" instead of treating it as an out-of-order
option. But where POSIX does not forbid it, the bulk of the coreutils
have GNU behavior of accepting any number of options, in any location
prior to the first --.
- --
Life is short - so eat dessert first!
Eric Blake address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFDmYSG84KuGfSFAYARAgoJAKCtNiZEpeYadauAs37/Ve1A3JlIJACfT/G/
lZWqYIID5zgYxPiIe/zp+Z8=
=M9P1
-----END PGP SIGNATURE-----
Index: src/test.c
===================================================================
RCS file: /cvsroot/coreutils/coreutils/src/test.c,v
retrieving revision 1.124
diff -u -p -r1.124 test.c
--- src/test.c 16 Sep 2005 07:42:56 -0000 1.124
+++ src/test.c 9 Dec 2005 13:11:52 -0000
@@ -822,7 +822,7 @@ main (int margc, char **margv)
"[" form, and when the last argument is not "]". POSIX
allows "[ --help" and "[ --version" to have the usual GNU
behavior, but it requires "test --help" and "test --version"
- to exit silently with status 1. */
+ to exit silently with status 0. */
if (margc < 2 || !STREQ (margv[margc - 1], "]"))
{
parse_long_options (margc, margv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
- bug with 'test', Adam Chou, 2005/12/08
- Re: bug with 'test', The Wanderer, 2005/12/08
- Re: bug with 'test', Eric Blake, 2005/12/08
- Message not available
- Re: bug with 'test',
Eric Blake <=
- Re: bug with 'test', Jim Meyering, 2005/12/09
- Re: bug with 'test', The Wanderer, 2005/12/09
- Re: bug with 'test', Paul Eggert, 2005/12/09
- Re: bug with 'test', The Wanderer, 2005/12/09
- Re: bug with 'test', Paul Eggert, 2005/12/10
- mailing list headers (Re: bug with 'test'), Bob Proulx, 2005/12/09
- Re: bug with 'test', Eric Blake, 2005/12/10