Subject: bin/24449: sort(1) completely broken
To: None <gnats-bugs@gnats.NetBSD.org>
From: None <itojun@itojun.org>
List: netbsd-bugs
Date: 02/17/2004 11:32:29
>Number:         24449
>Category:       bin
>Synopsis:       sort(1) completely broken
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Feb 17 02:34:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     Jun-ichiro itojun Hagino
>Release:        NetBSD 1.6ZK
>Organization:
	itojun.org
>Environment:
System: NetBSD starfruit.itojun.org 1.6ZK NetBSD 1.6ZK (STARFRUIT) #559: Tue Feb 17 07:41:42 JST 2004 itojun@starfruit.itojun.org:/home/itojun/NetBSD/src/sys/arch/i386/compile/STARFRUIT i386
Architecture: i386
Machine: i386
>Description:
	with the recent changes to usr.bin/sort, sort is completely broken.
>How-To-Repeat:
# cd regress/usr.bin/sort; make regress
Note: some sort(1) implementations (for example GNU sort) may not pass these
tests - this suite was made to fit sort(1) using (non-stable) radixsort(3),
sort(1) using other algorithm may give different results, though still
conform to standard.

Obsolescent and nonstandard features recognized, if any:
	+1 -2
	displaced -o
	-s stable sort
	-S non-stable sort
	-T tempdir (not exercised)
01
02
option -c is noisy (probably legal)
03
[1]   Segmentation fault      sort ${S} "${@}"...
03 failed - sort -n
04
05
05A comparison failed - sort +1 -2
sort: +2r: No such file or directory
05B failed - sort +1 -2 +2r
05C comparison failed - sort -k 2,2
05D comparison failed - sort -k 2,2 -k 3r
05E comparison failed - sort -k 2,2.0
05F comparison failed - sort -k 2,2 -k 1,1 -k 3
06
06B comparison failed - sort -t : +0 -1
06D comparison failed - sort -t : -k 1,1
07
07A comparison failed - sort -b -t: +1.1
07B comparison failed - sort -t: +1.1r
07C comparison failed - sort -b -t: -k 2.2
07D comparison failed - sort -t: -k 2.2r
08
08A comparison failed - sort -t   -k2,2
08B comparison failed - sort -t   -k2.1,2.0
08C comparison failed - sort -t 	 -k2,2
08D comparison failed - sort -t 	 -k2.1,2.0
08E comparison failed - sort -k2
09
09 comparison failed - sort -tX -k2 -k1r,1
10
11
12
[1]   Segmentation fault      sort ${S} "${@}"...
12A failed - sort -mudf
(other behavior is legal, not classical)
[1]   Segmentation fault      sort ${S} "${@}"...
12B failed - sort -mudf -k1
(other behavior is legal, not classical)
13
13B comparison failed - sort -k 1,1r -k 1
14 (3 long parts)
14 (part A done)
[1]   Segmentation fault      sort ${S} "${@}"...
14B failed - sort -n
14 (part B done)
[1]   Segmentation fault      sort ${S} "${@}"...
14C failed - sort -n -u
15 (long)
16
[1]   Done                    awk "BEGIN { for... |
      Segmentation fault      sort ${S} -nr in...
[1]   Done                    awk "BEGIN { for... |
      Segmentation fault      sort ${S} -mn in...
17
sort: +0d: No such file or directory
17A failed - sort -df +0 +0d
17B comparison failed - sort -df -k 1 -k 1d
18
18C failed
19
19A comparison failed - sort -i -k 2
19B comparison failed - sort -d -k 2
19C comparison failed - sort -f -k 2
20
[1]   Segmentation fault      sort ${S} "${@}"...
20A failed - sort -d
[1]   Segmentation fault      sort ${S} "${@}"...
20C failed - sort -dfb
21
22
22 comparison failed - sort -r -k1,1 -k2n
23
24
24 comparison failed - sort -t: -k9 -k8 -k7 -k6 -k5 -k4 -k3 -k2 -k1
25
26
27
28
sort in free(): error: junk pointer, too high to make sense.
[1]   Abort trap              sort ${S} "${@}"...
28A failed - sort +1 -0.3 +1.4 -1.5
28B comparison failed - sort -k2,1.3 -k2.5,2.5
29
30
31
31B skipped - flag '-M' not supported
32
32B skipped - flag '-M' not supported
33
33B skipped - flag '-g' not supported
34
34B skipped - flag '-g' not supported
[1]   Segmentation fault      sort ${S} "${@}"...
34B failed - sort -n
35
35B skipped - flag '-g' not supported
36
36 comparison failed - sort -s -k1,1
37
37 failed - sort -smru -k1,1
38
38 comparison failed - sort -m -s -k1,1n
39
40 (long)
41
42
>Fix:
	fix it please, jdolecek.
>Release-Note:
>Audit-Trail:
>Unformatted: