GNU bug report logs - #23556
sort(1): misleading description of option -n

Previous Next

Package: coreutils;

Reported by: Carsten Hey <carsten <at> debian.org>

Date: Mon, 16 May 2016 18:29:01 UTC

Severity: normal

Done: Assaf Gordon <assafgordon <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Carsten Hey <carsten <at> debian.org>
To: 23556 <at> debbugs.gnu.org
Subject: bug#23556: sort(1): misleading description of option -n
Date: Sat, 14 May 2016 16:17:35 +0200
Hi,

the man page sort(1) contains a misleading description of the option -n:

    $ lsb_release -ic
    Distributor ID: Debian
    Codename:       jessie

    $ sort --version | sed -n 1p
    sort (GNU coreutils) 8.23

    $ man sort | grep -A1 -- --numeric-sort | sed -n -e 's/^ *//' -e '1!p'
    compare according to string numerical value

According to Ubuntu's web page, this string is also in their package
coreutils_8.25-2ubuntu2_i386.


This description reads as if this command:

    $ printf '%s\n' 'x 9' 'x 10' | sort -n
    x 10
    x 9

… would produce the output of this command:

    $ printf '%s\n' 'x 9' 'x 10' | sort -V
    x 9
    x 10

…, but instead, -n stops doing its magic after finding the first
non-numeric, non-whitespace character.  There is a short and simple
way to summarize this behaviour.


If you use Cyanogenmod on your mobile phone, you carry a minor
programming error in your pocket that is very likely caused by this
misleading description of -n.


Regards
Carsten




This bug report was last modified 6 years and 211 days ago.

Previous Next


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