Subject: bug#8442: closed (Re: bug#8442: sort command in Redhat 5 does not work)

From: [email-masked] (GNU bug Tracking System)
Date: Thu, 07 Apr 2011 21:14:02 +0000

Your bug report

#8442: sort command in Redhat 5 does not work

which was filed against the coreutils package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
8442: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8442
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#8442: sort command in Redhat 5 does not work
From: Eric Blake <[email-masked]>
To: Jyotin Patel <[email-masked]>
Cc: [email-masked]
Date: Thu, 07 Apr 2011 15:12:51 -0600
List-Id: <debbugs-submit.debbugs.gnu.org>

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@cnprodedi01 mail]# cat /etc/redhat-release
> Red Hat Enterprise Linux Server release 5.6 (Tikanga)
> [root@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   [email-masked]    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Subject: sort command in Redhat 5 does not work
From: "Jyotin Patel" <[email-masked]>
To: <[email-masked]>
Date: Thu, 7 Apr 2011 15:40:36 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

[root@cnprodftp02 root]# cat /etc/redhat-release
Red Hat Enterprise Linux AS release 3 (Taroon Update 5)
[root@cnprodftp02 root]# sort

[root@cnprodftp02 root]# set -o vi
 
[root@cnprodftp02 root]# grep prftp /etc/passwd | sort -n +2 -t':' |
head -2
xmit:x:150:204::/prftp/forwarder:/bin/bash
anl:x:213:206:test user:/prftp/carriers/anl:/sbin/nologin

[root@cnprodftp02 root]# uname -a
Linux cnprodftp02 2.4.21-32.0.1.ELsmp #1 SMP Tue May 17 17:52:23 EDT
2005 i686 i686 i386 GNU/Linux

Sort does not work on REdhat-AS5 ; it used to work on Redhat AS-3

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

[root@cnprodftp02 bin]# uname -a
Linux cnprodftp02 2.6.18-238.5.1.el5 #1 SMP Mon Feb 21 05:52:39 EST 2011
x86_64 x86_64 x86_64 GNU/Linux

Thanks.
Jay Patel
Systems Administrator
INTTRA
+1 973.265.2263 Office 
+1 973.641.0510 Mobile 
+1 973.263.5969 Fax
www.inttra.com <http://www.inttra.com/> 
This e-mail and any attachments thereto are intended only for use by the addressee(s) named herein and may contain proprietary and/or confidential information. If you are not the intended recipient of this e-mail, you are hereby notified that any dissemination, distribution or copying of this e-mail, and any attachments thereto, is strictly prohibited. If you have received this e-mail in error, please immediately notify [email-masked] and permanently delete the original, any attachments, any copies thereof, and any printouts thereof.