bug-coreutils
[Top][All Lists]
Advanced

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

Re: sort +k


From: Eric Blake
Subject: Re: sort +k
Date: Sat, 27 Jun 2009 12:04:17 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.22) Gecko/20090605 Thunderbird/2.0.0.22 Mnenhy/0.7.6.666

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

According to Wayne Power on 6/27/2009 11:52 AM:
> sort: open failed: +1: No such file or directory
> 
> WTF?  sort -k?  Is there any good reason you decided to break every
> every shell script I've written in the last 30 years that uses sort?

Yes, and that reason is POSIX.  Coreutils did not make this change
lightly; the standards committees did and coreutils is downstream from the
standards.

That said, the coreutils documentation mentions this in the NEWS:

|   A few usages still have behavior that depends on which POSIX standard is
|   being conformed to, and portable applications should beware these
|   problematic usages.  These include:
|
|     Problematic       Standard-conforming replacement, depending on
|        usage            whether you prefer the behavior of:
|                       POSIX 1003.2-1992    POSIX 1003.1-2001
|     sort +4           sort -k 5            sort ./+4
|     tail +4           tail -n +4           tail ./+4
|     tail - f          tail f               [see (*) below]
|     tail -c 4         tail -c 10 ./4       tail -c4
|     touch 12312359 f  touch -t 12312359 f  touch ./12312359 f
|     uniq +4           uniq -s 4            uniq ./+4
|
|     (*) "tail - f" does not conform to POSIX 1003.1-2001; to read
|     standard input and then "f", use the command "tail -- - f".
|
|   These changes are in response to decisions taken in the January 2005
|   Austin Group standardization meeting.  For more details, please see
|   "Utility Syntax Guidelines" in the Minutes of the January 2005
|   Meeting <http://www.opengroup.org/austin/docs/austin_239.html>.

You may also find it informative to read: 'info coreutils standards'.

> Is this a special version for Apple to piss off old unix folks, or did
> you break this command for everybody?

Because of POSIX, using 'sort +1' is inherently non-portable for everyone.

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

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

iEYEARECAAYFAkpGXyEACgkQ84KuGfSFAYCzZgCguuOl+LodRRuKWQG/X4Asc98A
W28AnAkgqoLxvBL+Y8ng3Dz7gJbvk2CQ
=pc1x
-----END PGP SIGNATURE-----




reply via email to

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