Bug 10570 - /bin/sort broken
/bin/sort broken
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: textutils (Show other bugs)
6.2
All Linux
medium Severity medium
: ---
: ---
Assigned To: Bernhard Rosenkraenzer
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2000-04-03 20:02 EDT by martin
Modified: 2008-05-01 11:37 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2000-04-24 18:21:10 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description martin 2000-04-03 20:02:12 EDT
sort -n is broken.

for example, if you have a hosts file that looks like this:

192.168.1.7    moe
172.16.1.30   larry
192.168.1.200  curly
192.168.1.7    moe

and you then run this command:

  cat hosts | sort -un -t'.' -k1,1 -k2,2 -k3,3 -k4,4

you should get the output:

172.16.1.30   larry
192.168.1.7   moe
192.168.1.200 curly

but instead, I get the output:

172.16.1.30   larry
192.168.1.200 curly
192.168.1.7   moe

It is using ascii order to sort, rather than number order as it should
wehen you use the -n option.  This works fine under 6.1, and 5.1, but I do
seem to recall seeing this problem before on RH, possibly 5.2 or 6.0 -- I
can't say for certain.

Note that the reason (as you're no doubt going to be inclined to ask) for
the duplicate entries is that I'm using this to sort the output of a ypcat
hosts, and we have multiple aliases for each host, so ypcat generates one
line for each alias, necessitating the -u (unique) option.

I include this info because it is the specific test case where I discovered
it is broken.  I removed the -u option and I've found that this does not
improve the situation, so it is at least not a case where the parser is
getting confused between the -u and -n options.
Comment 1 Anonymous 2000-04-18 17:01:59 EDT
Its more basic than that.
# cat > eeep
1
10
1000
100
# sort -n eeep
100
1000
10
1
# /bin/sort -g eeep
1
10
100
1000
Comment 2 Trond Eivind Glomsrxd 2000-04-24 18:21:59 EDT
I removed two patches which made this happen and put it in the rawhide tree..
whether this is a final solution remains to be seen.
Comment 3 Michael 2000-05-01 17:13:59 EDT
textutils-2.0e-1.i386.rpm (from current rawhide on ftp.redhat.com) is broken.
echo 1 12 10 8 | tr ' ' '\n' | sort -n
8
10
12
1
See Zoot-List for more details...
Comment 4 mw 2000-05-02 14:00:59 EDT
Why not run the tests included in the textutils tar ball?  Just run `make
check'.

Here is what I get, for example:

# cd /usr/src/redhat/BUILD/textutils-2.0e/tests/sort
# make check
make  check-TESTS
make[1]: Entering directory
`/hda5/usr/src/redhat/BUILD/textutils-2.0e/tests/sort'
*** 18a.O	Tue May  2 12:53:45 2000
--- ./18a.X	Sat Feb 12 05:42:36 2000
***************
*** 1,2 ****
- 100
   901
--- 1,2 ----
   901
+ 100
*** 18b.O	Tue May  2 12:53:45 2000
--- ./18b.X	Sat Feb 12 05:42:36 2000
***************
*** 1,2 ****
- 100
   901
--- 1,2 ----
   901
+ 100
*** 18c.O	Tue May  2 12:53:45 2000
--- ./18c.X	Sat Feb 12 05:42:36 2000
***************
*** 1,2 ****
 100
   901
--- 1,2 ----
   901
+ 100
FAIL: sort-tests
===================
1 of 1 tests failed
===================
make[1]: *** [check-TESTS] Error 1
make[1]: Leaving directory
`/hda5/usr/src/redhat/BUILD/textutils-2.0e/tests/sort'
make: *** [check-am] Error 2


The new patches (to 2.0e) give the new errors:

make[2]: Entering directory `/hda5/usr/src/redhat/BUILD/textutils-2.0e/doc'
Updating ./version.texi
cd . \
  && makeinfo --no-split `echo textutils.texi | sed 's,.*/,,'`
Making info file `textutils.info' from `textutils.texi'.
textutils.texi:109: No matching `@end ifnottex'.
textutils.texi:209: Unmatched `@end'.
textutils.texi:1827: Unknown command `env'.
textutils.texi:1827: Misplaced {.
textutils.texi:1827: Misplaced }.

[...]

When I remove the patches RH applies to textutils, all is fine.  See

ftp://moni.msci.memphis.edu/pub/textutils.spec

Mate

Note You need to log in before you can comment on or make changes to this bug.