🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.bugs.sys5
Article #371

Bug in sort(1) when using +m.n -o.p and -tc

#371
From: David E A Wilson
Date: Thu, 11 Apr 1991 03:19
34 lines
1655 bytes
I have run into a bug in the sort(1) command on a Sun4 running SunOS 4.1.1.
This occurs both with /usr/bin/sort and /usr/5bin/sort. The problem also
appears on a Sequent Symmetry running Dynix 2.0v2 (both ucb sort and att sort)
and finally with the sort command compiled using the 4.3-bsd tahoe sources.

The bug is as follows. I am trying to sort on the 2nd character of the second
field of a colon separated record. If this character compares equal I then
sort on the 1st character of the 2nd field.

/usr/bin/sort -t: +1.1 -1.2 +1.0 -1.1 <<!
abc:Ab:xyz
def:zA:pqr
!

This results in:

Script started on Thu Apr 11 13:16:57 1991
$ /usr/bin/sort -t: +1.1 -1.2 +1.0 -1.1 <<!
>abc:Ab:xyz
>def:zA:pqr
>!
abc:Ab:xyz
def:zA:pqr
$ 
script done on Thu Apr 11 13:17:11 1991

Which is incorrect. The same input to "sort +0.5 -0.6 +0.4 -0.5" will however
work (but is useless if the first field is not fixed length).

The problem appears to be in the skip function used to find the start and end
of sort keys. Patching it to add one to the end pointer fixes my problem but
may introduce other problems.
-- 
David Wilson	Dept Comp Sci, Uni of Wollongong	david@cs.uow.edu.au
Technical Details
Message-ID: <1991Apr11.031926.19901@cs.uow.edu.au>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!spool.mu.edu!munnari.oz.au!metro!cs.uow.edu.au!david

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!spool.mu.edu!munnari.oz.au!metro!cs.uow.edu.au!david
From: david@cs.uow.edu.au (David E A Wilson)
Newsgroups: comp.bugs.sys5,comp.bugs.4bsd
Subject: Bug in sort(1) when using +m.n -o.p and -tc
Keywords: sort bug
Message-ID: <1991Apr11.031926.19901@cs.uow.edu.au>
Date: 11 Apr 91 03:19:26 GMT
Organization: Dept of Computer Science, Wollongong University
Lines: 34