CFT: new BSD-licensed sort available
freebsd-ports-local at be-well.ilk.org
Fri Mar 16 22:37:32 UTC 2012
Chris Rees <crees at freebsd.org> writes:
> On 15 March 2012 19:18, Lowell Gilbert
> <freebsd-ports-local at be-well.ilk.org> wrote:
>> Gabor Kovesdan <gabor at FreeBSD.org> writes:
>>> some time ago I started writing a BSDL sort variant from scratch since
>>> the OpenBSD version did not support multibyte locales and was hard to
>>> modify. The development was a bit stalled but recently, Oleg
>>> Moskalenko <oleg.moskalenko at citrix.com> showed interest in continuing
>>> this version and he has made a very good job on this BSD sort
>>> variant. Now it is compatible with the base version of GNU sort but
>>> the performance in most cases (string sort and -n) is quite behind GNU
>>> sort (although with -g it is about *4 times* faster). Oleg is still
>>> working on optimizing the code and the long-term plan is to drop GNU
>>> sort once this variant is good enough to replace it. For now, it is
>>> only available in Ports Collection as textproc/bsdsort but if there is
>>> no objection or any serious bug report I plan to add it to base
>>> installed as bsdsort, being GNU sort still the default sort until it
>>> proves that we can safely drop GNU sort. If you are interested in this
>>> sort utility, could you please try the port and report us any issue
>>> that you experience?
>> portsdb(1) (from portupgrade) doesn't seem to like it;
>> apparently it is missing a '-2' option, which I haven't
>> tracked down yet...
> Fails with gnusort too anyway:
> [crees at pegasus]~% gsort -2
> gsort: invalid option -- '2'
> Try `gsort --help' for more information.
> [crees at pegasus]~%
As it turns out, this *is* something that Gnu sort supports, although
the documentation claims that the syntax is obsolete -- and doesn't
document it very well.
 (lowell-desk) ~> printf "fee\nfie\nfoe\nfum\nfoo\nbaz" |gsort -t 'a' +1 -2
 (lowell-desk) ~>
It wouldn't be bad if BSD sort supported it, but it should definitely be
fixed in the ports Makefile. I have submitted the fix in a PR:
Personally, I'd don't see any reason for bsdsort to include this
More information about the freebsd-ports