GNU bug report logs -
#23090
true and false not POSIX
Previous Next
Reported by: Ruediger Meier <sweet_f_a <at> gmx.de>
Date: Tue, 22 Mar 2016 12:44:02 UTC
Severity: normal
Tags: notabug
Done: Eric Blake <eblake <at> redhat.com>
Bug is archived. No further changes may be made.
Full log
Message #26 received at 23090 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On 03/22/2016 09:13 AM, Eric Blake wrote:
> On 03/22/2016 06:43 AM, Ruediger Meier wrote:
>> Hi,
>>
>> Is there any good reason why coreutils true and false are not POSIX?
>
> No, because coreutils' true and false ARE compliant with POSIX.
>
>> But coreutils true has --version and --help implemented. It needs
>>> /dev/null redirection to work as expected.
>
> Not true. POSIX says that behavior is unspecified for 'true --help'.
> Therefore, whatever coreutils does in that case does not violate POSIX.
>
> 'true -- --help', on the other hand, must be silent - but coreutils
> obeys that rule.
Correction - POSIX says that 'true -- --help' is unspecified, so
coreutils can do whatever it wants (and in that case, GNU coreutils
opted to treat '--help' as an ignored operand, because the '--' ended
the chance to treat it as an option).
According to POSIX, the _only_ specified use of 'true' is without operands:
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/true.html
> SYNOPSIS
>
> true
Any other arguments on the command line are extensions, and can behave
however the implementation wants; portable apps will not be invoking
'true' with arguments, because they are no longer getting behavior
mandated by POSIX.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[signature.asc (application/pgp-signature, attachment)]
This bug report was last modified 9 years and 61 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.