[Top][All Lists]

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

bug#23090: true and false not POSIX

From: Ruediger Meier
Subject: bug#23090: true and false not POSIX
Date: Tue, 22 Mar 2016 19:35:39 +0100
User-agent: KMail/1.9.10

On Tuesday 22 March 2016, Eric Blake wrote:
> On 03/22/2016 11:56 AM, Ruediger Meier wrote:
> >> 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.
> >
> > I knew this note. However in the real world it simply does not make
> > sense to get a man page about something which is not used usually.
> It's not coreutils' fault if distros don't know how to make 'man
> true' redirect to the shell's man page.
> > I suggest an enhancement for portability and implementation
> > simplicity to remove the options --version and --help from true,
> > false echo and [.
> Sorry, but that would violate GNU Coding Standards, so we aren't
> going to do it.

So then test --help is a coreutils bug because it does not respect GNU 
Coding Standard? As already said the exit codes are for sure not 
GNU-style too.

What about changing GNU Coding Standards to allow to break them if they 
don't make any sense like in this case?

> > It's a problem that the most used implementations (POSIX or
> > built-ins) behave differently and users might not be aware this
> > fact when they use the coreutils implementations by mistake or on
> > purpose. Since the use cases when somebody really needs a true,
> > false or echo _binary_ are rare, the probabilty is high that the
> > user assumes well known behavior.
> The probability that someone knows well-known GCS behavior of
> '--help' working are also high.  At this point, the change would be
> more disruptive than keeping the status quo.

Yep one might use it in scripts wrongly:

/bin/false --version &>/dev/null || echo "cant determine version"

or right:

if test -n "$(/usr/bin/true --help)"; then
  rm -f /usr/bin/true
  echo 'int main(int argc, char **argv){return 0;}'> /tmp/true.c
  cc /tmp/true.c -o /usr/bin/true


reply via email to

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