Subject: Re: bug#23090: true and false not POSIX

From: Eric Blake <[email-masked]>
Date: Tue, 22 Mar 2016 10:48:16 -0600

On 03/22/2016 10:38 AM, Ruediger Meier wrote:
> I've seen many existing scripts where people do something like this:
> 
> cmd=whatever
> # ignore if not exist
> type "$cmd" || cmd="true"
> [...]
> $cmd --something --we --want --to --do --if --possible
> [...]

Such scripts are non-portable.  They could use:

type "$cmd" || cmd=:

for more portability.  It's not our fault that non-portable scripts exist.

> BTW this man page does not match to the most probably used built-in 
> command. This confuses the reader even more and is IMO another argument 
> why coreutils shouldn't have added --help options for these kind of 
> commands.

The man page (and --help output) specifically state:

       NOTE: your shell may have its own version of true, which usually
super‐
       sedes the version described here.  Please refer to your  shell's
 docu‐
       mentation for details about the options it supports.

So far, you haven't identified anything that we need to change in
behavior in either 'true' or 'false' (certainly not any changes required
for POSIX compliance, although it appears you are now moving on to
questioning our extension behavior when used in ways not mandated by
POSIX).  Therefore, I've taken the liberty of closing this bug report.
But feel free to continue discussion, and if you can come up with a
change that we _should_ make that won't disrupt existing clients, then
we can reopen the bug to track that.  Note that it is a high bar to
change the behavior of something like 'true'.

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