I was quite surprised to discover that /bin/sort produces incorrect
answers. This is the version of /bin/sort that comes with Red Hat Linux
6.2 distribution:
$ sort --version
sort (GNU textutils) 2.0a
Written by Mike Haertel.
Copyright (C) 1999 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is
NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
-------- Input File /tmp/sort.screwup --------
1
12880
13077
13079
13127
13129
13131
13148
13150
13152
13156
13212
2
261
276
277
286
3
300
4
486
5
522
6
671
680
6826
6827
711
712
883
890
891
8946
895
899
------------- Invocation ---------
$ sort -n /tmp/sort.screwup
or
$ sort -s -n /tmp/sort.screwup
------------- Expected Output ------
1
2
3
4
5
6
261
276
277
286
300
486
522
671
680
711
712
883
890
891
895
899
6826
6827
8946
12880
13077
13079
13127
13129
13131
13148
13150
13152
13156
13212
-------------- Actual buggy Output -----------
899
2
3
286
4
300
5
486
13212
277
276
261
671
6
522
711
883
712
895
6827
8946
891
890
6826
680
12880
1
13079
13077
13131
13129
13127
13150
13148
13156
13152
----------------------------------------------------------------
Note that earlier versions of /bin/sort produce correct answers:
$ sort --version
sort (GNU textutils) 1.22
+-----------------------------------------------
| Vitaly M. Oratovsky Email [EMAIL PROTECTED] \ __ ____
| Mercury Computer Systems http://source/~vmo \___| \____o_/_/__ |
| 199 Riverneck Road (978) 256-0052 x 1345/ `------_/_/___]>
| Chelmsford MA 01824-2820 (978) 256-3599 Fax / `o |
+-http://www.mc.com ---------------------------'