Subject: bin/36816: [dM] sort -n mis-sorts -ve numbers
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: netbsd-bugs
Date: 08/21/2007 17:05:00
>Number:         36816
>Category:       bin
>Synopsis:       [dM] sort -n mis-sorts -ve numbers
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Aug 21 17:05:00 +0000 2007
>Originator:     der Mouse
>Release:        NetBSD 3.1
>Organization:
	Dis-
>Environment:
This has been seen on three systems:

System: NetBSD Omega.Rodents.Montreal.QC.CA 3.1 NetBSD 3.1 (OMEGA) #2: Sun Aug 19 19:49:12 EDT 2007 mouse@Omega.Rodents.Montreal.QC.CA:/home/mouse/kbuild/OMEGA alpha
Architecture: alpha
Machine: alpha

System: NetBSD Darkstar.Rodents.Montreal.QC.CA 3.1 NetBSD 3.1 (DARKSTAR) #1: Sun Aug 12 13:19:04 EDT 2007  mouse@Darkstar.Rodents.Montreal.QC.CA:/usr/src/sys/arch/hpcmips/compile/DARKSTAR hpcmips
Architecture: mipsel
Machine: hpcmips

System: NetBSD NetBSD-3-1.Rodents.Montreal.QC.CA 3.1 NetBSD 3.1 (GEN31) #0: Sun Aug 12 15:07:30 EDT 2007  mouse@NetBSD-3-1.Rodents.Montreal.QC.CA:/home/mouse/kbuild/GEN31 i386
Architecture: i386
Machine: i386
>Description:
	sort(1) mis-sorts negative numbers under at least some
	circumstances.  I haven't explored the envelope of the bug much.
>How-To-Repeat:
	This behaves the same on all three of the above-mentioned
	machines:

	% echo -512 -511 -510 -509 -508 -501 -500 | /usr/bin/tr \  \\n | sort -n
	-510
	-512
	-511
	-500
	-509
	-508
	-501
	% 
>Fix:
	Unknown.  Could this be related to 30504?  The test case given
	there does not misbehave for me, fwtmbw.

	3.0, 2.0, 1.6.2, 1.6.1 all misbehave as illustrated above for
	me (tested on i386 only).  1.4T does not, interestingly.

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML	       mouse@rodents.montreal.qc.ca
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B