Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Feb 2010 13:49:05 +0300
From:      Ruslan Ermilov <ru@FreeBSD.org>
To:        stable@freebsd.org
Subject:   Re: numeric sort(1) is broken on -STABLE
Message-ID:  <20100210104904.GA85373@edoofus.dev.vega.ru>
In-Reply-To: <20100210085814.GE9748@acme.spoerlein.net>
References:  <20100210085814.GE9748@acme.spoerlein.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Feb 10, 2010 at 09:58:14AM +0100, Ulrich Spörlein wrote:
> Hi guys,
> 
> not sure if this is a pilot error, but it seems to me that gnu sort -n
> is broken on at least -STABLE (couldn't test -CURRENT yet).
> 
> It somehow does not manifest when using a simple list and sorting on a
> specific column, but it always happens to me when using it in
> combination with find(1).
> 
> % truncate -s10m a; truncate -s5m b; truncate -s800k c
> % find a b c -ls|sort -nk7,7
>      8       64 -rw-r--r--    1 uqs              wheel            10485760 Feb 10 09:13 a
>     10       64 -rw-r--r--    1 uqs              wheel             5242880 Feb 10 09:13 b
>     12       64 -rw-r--r--    1 uqs              wheel              819200 Feb 10 09:13 c

I bet you're using some non-C locale for LC_NUMERIC.
What does "locale" output tell you?

> % find a b c -ls|sort -gk7,7
>     12       64 -rw-r--r--    1 uqs              wheel              819200 Feb 10 09:13 c
>     10       64 -rw-r--r--    1 uqs              wheel             5242880 Feb 10 09:13 b
>      8       64 -rw-r--r--    1 uqs              wheel            10485760 Feb 10 09:13 a
> 
> at least -g does what is expected and I can work around this for the time being. Here's bsdsort
> 
> % find a b c -ls|bsdsort -nk7,7
>     12       64 -rw-r--r--    1 uqs              wheel              819200 Feb 10 09:13 c
>     10       64 -rw-r--r--    1 uqs              wheel             5242880 Feb 10 09:13 b
>      8       64 -rw-r--r--    1 uqs              wheel            10485760 Feb 10 09:13 a
> 
> and this is on Solaris 8
> 
> % find a b c -ls|sort -nk7,7
> 546728   16 -rw-r--r--   1 spoerul xxx        819200 Feb 10 09:49 c
> 546727   16 -rw-r--r--   1 spoerul xxx       5242880 Feb 10 09:48 b
> 546724   16 -rw-r--r--   1 spoerul xxx      10485760 Feb 10 09:48 a
> 
> It even occured to me, that we don't have a sort regression suite under
> tools/regression. Anyone know a place to find one with a suitable license?
> 
> Regards,
> Uli
> _______________________________________________
> freebsd-stable@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-stable
> To unsubscribe, send any mail to "freebsd-stable-unsubscribe@freebsd.org"
> 

-- 
Ruslan Ermilov
ru@FreeBSD.org
FreeBSD committer



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100210104904.GA85373>