NetBSD-Bugs archive

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

bin/37860: sort -n sorts 0 after 0.1



>Number:         37860
>Category:       bin
>Synopsis:       sort -n sorts 0 after 0.1
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jan 24 11:35:00 +0000 2008
>Originator:     Alexander Becher
>Release:        NetBSD 3.1_STABLE
>Organization:
>Environment:
        
        
System: NetBSD abc 3.1_STABLE NetBSD 3.1_STABLE (abc) #1: Sat Sep 29 22:43:36 
CEST 2007 alex@abc:/usr/obj/sys/arch/i386/compile/abc i386
Architecture: i386
Machine: i386

$ ident /usr/bin/sort
/usr/bin/sort:
     $NetBSD: crt0.c,v 1.13 2003/07/26 19:24:27 salo Exp $
     $NetBSD: append.c,v 1.13 2004/02/15 11:52:12 jdolecek Exp $
     $NetBSD: fields.c,v 1.18 2004/03/14 21:12:14 heas Exp $
     $NetBSD: files.c,v 1.23 2004/02/15 11:52:12 jdolecek Exp $
     $NetBSD: fsort.c,v 1.30 2004/02/15 11:54:17 jdolecek Exp $
     $NetBSD: init.c,v 1.16 2004/11/03 20:14:36 dsl Exp $
     $NetBSD: msort.c,v 1.17 2004/02/17 19:09:36 jdolecek Exp $
     $NetBSD: sort.c,v 1.41 2004/07/23 13:26:11 wiz Exp $
     $NetBSD: tmp.c,v 1.11 2003/08/07 11:32:34 jdolecek Exp $

>Description:
Sorting lines that contain only numbers between 0 and 1 with the -n
option leads lines that contain only "0" to be sorted after lines that
start with "0.0". Obviously, 0.01 < 0 < 0.2 is wrong, but that's the
resulting sort order.
>How-To-Repeat:
        
$ echo -e "0.01\n0.4\n0.0\n0\n0.2" | /usr/bin/sort -n
0.0
0.01
0
0.2
0.4

>Fix:
As a work-around, I used GNU sort.

>Unformatted:
        
        



Home | Main Index | Thread Index | Old Index