GNU bug report logs - #8442
coreutils 5.90 (2005-09-29) drops support for +N option usage

Previous Next

Package: coreutils;

Reported by: "Jyotin Patel" <Jyotin.Patel <at> inttra.com>

Date: Thu, 7 Apr 2011 19:56:02 UTC

Severity: normal

Tags: moreinfo, notabug

Done: Eric Blake <eblake <at> redhat.com>

Bug is archived. No further changes may be made.

Full log


Message #10 received at 8442-done <at> debbugs.gnu.org (full text, mbox):

From: Eric Blake <eblake <at> redhat.com>
To: Jyotin Patel <Jyotin.Patel <at> inttra.com>
Cc: 8442-done <at> debbugs.gnu.org
Subject: Re: bug#8442: sort command in Redhat 5 does not work
Date: Thu, 07 Apr 2011 15:12:51 -0600
[Message part 1 (text/plain, inline)]
On 04/07/2011 01:40 PM, Jyotin Patel wrote:
> 
> Sort does not work on REdhat-AS5 ; it used to work on Redhat AS-3

> [root <at> cnprodedi01 mail]# cat /etc/redhat-release
> Red Hat Enterprise Linux Server release 5.6 (Tikanga)
> [root <at> cnprodedi01 mail]# grep prftp /etc/passwd | sort -n +2 -t':' |
> head -2
> sort: open failed: +2: No such file or directory

Thanks for the report.  However, this is not a bug in sort, but a
misunderstanding on your part about changes to sort syntax as POSIX has
evolved over the years.  From the NEWS file:

  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


See also 'info coreutils standards' for information on how to set
_POSIX2_VERSION=199209 for the behavior you were expecting.

But in general, the old +2 syntax should be converted to the newer
POSIX-compliant -k3 (or even the safer -k3,3) instead.  Newer coreutils
(the latest is 8.10) added a --debug option, to help in that:

$ echo hi | _POSIX2_VERSION=199209 sort -n +2 -t: --debug
sort: using `en_US.UTF-8' sorting rules
sort: obsolescent key `+2' used; consider `-k 3' instead
sort: key 1 is numeric and spans multiple fields
hi
  ^ no match for key
__


-- 
Eric Blake   eblake <at> redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

[signature.asc (application/pgp-signature, attachment)]

This bug report was last modified 14 years and 54 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.