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 #15 received at control <at> debbugs.gnu.org (full text, mbox):

From: Bob Proulx <bob <at> proulx.com>
To: Jyotin Patel <Jyotin.Patel <at> inttra.com>
Cc: 8442 <at> debbugs.gnu.org
Subject: Re: bug#8442: sort command in Redhat 5 does not work
Date: Thu, 7 Apr 2011 15:19:48 -0600
retitle 8442 coreutils 5.90 (2005-09-29) drops support for +N option usage
tags 8442 + moreinfo notabug
thanks

Jyotin Patel wrote:
> [root <at> 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

You are using obsolete options that are not portable.  The +2 and -2
options are problematic.  Don't use them.

> 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

That is correct.  This is documented in the NEWS file.

    Major changes in release 5.90 (2005-09-29) [unstable]

     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.

Also the coreutils info manual has the following documentation.

    The gnu utilities normally conform to the version of POSIX that is
    standard for your system.  To cause them to conform to a different
    version of POSIX, define the _POSIX2_VERSION environment variable
    to a value of the form yyyymm specifying the year and month the
    standard was adopted.  Two values are currently supported for
    _POSIX2_VERSION: ‘199209’ stands for POSIX 1003.2-1992, and
    ‘200112’ stands for POSIX 1003.1-2001.  For example, if you have a
    newer system but are running software that assumes an older
    version of POSIX and uses ‘sort +1’ or ‘tail +10’, you can work
    around any compatibility problems by setting
    ‘_POSIX2_VERSION=199209’ in your environment.

See also this FAQ entry:

  http://www.gnu.org/software/coreutils/faq/#Old-tail-plus-N-syntax-now-fails

Instead of:

> grep prftp /etc/passwd | sort -n +2 -t':' | head -2

Use something like this instead:

  $ sort -t : -k 3n,3 /etc/passwd | head -n 20

Bob




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.