bug-coreutils
[Top][All Lists]
Advanced

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

Re: coreutils 6.9 and yes


From: Eric Blake
Subject: Re: coreutils 6.9 and yes
Date: Fri, 25 May 2007 06:01:53 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.10) Gecko/20070221 Thunderbird/1.5.0.10 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Elan Ruusamäe on 5/25/2007 4:45 AM:
> `yes` from coreutils is incompatible with coreutils 5.2.1:
> 
> 5.2.1:
> $ yes -v | head -n3
> -v
> 6.9:
> $ yes -- -v | head -n3
> -v

Indeed.  And this was mentioned in the NEWS, so it was intentional.

> so how this can be invalid option if there is no short options at all in yes 
> binary (nor in manual or --help output)

The reason the change was made is because of POSIX, which states that all
new applications should follow the application option parsing guidelines,
one of which is that -- should be the end-of-options delimiter.  Just
because yes currently doesn't support options does not mean that it won't
in the future, so yes is actually more reliable by treating all leading -
as options if the -- is missing, then complaining loudly that the option
is not recognized, than it is to silently treat it as literal text and
then breaking if the text is turned into an option at a later date.  The
ONLY coreutils which do not follow this guideline are the ones specified
by POSIX (such as echo and test) as being exceptions to the POSIX option
guidelines, and that is because of backwards compatibility issues.

> 
> with such incompatabilities it's not possible to write portable code :/

'yes' is not specified by any standards, so it is not portable to begin
with.  If you want to use yes in a script, and want to guarantee that it
will work across 5.2.1 and 6.x, then you will have to do a feature test to
determine whether the -- is necessary; in fact, it can be part of the same
feature test that determines if yes is even available.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGVtAw84KuGfSFAYARAjEjAJ4mLRFKK8Aa1GNLIw3yS5Zy9oUGYgCfYyvn
gCKox9gzA5nI49p8fNhYGBs=
=C7c9
-----END PGP SIGNATURE-----




reply via email to

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