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 % 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
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 > % 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 aI can't repro this on 8.0-STABLE or 7.2-STABLE. /usr/bin/sort on these machines is what comes with the base system (which is GNU coreutils sort). Maybe your issue is related to locale(1) variables? $ uname -a FreeBSD icarus.home.lan 8.0-STABLE FreeBSD 8.0-STABLE #0: Sat Jan 16 17:48:04 PST 2010 root@icarus.home.lan:/usr/obj/usr/src/sys/X7SBA_RELENG_8_amd64 amd64 $ truncate -s10m a; truncate -s5m b; truncate -s800k c $ find a b c -ls | /usr/bin/sort -nk7,7 3078 1 -rw------- 1 jdc users 819200 10 Feb 01:11 c 3077 1 -rw------- 1 jdc users 5242880 10 Feb 01:11 b 3076 1 -rw------- 1 jdc users 10485760 10 Feb 01:11 a $ find a b c -ls | /usr/bin/sort -gk7,7 3078 1 -rw------- 1 jdc users 819200 10 Feb 01:11 c 3077 1 -rw------- 1 jdc users 5242880 10 Feb 01:11 b 3076 1 -rw------- 1 jdc users 10485760 10 Feb 01:11 a $ /usr/bin/sort --version sort (GNU coreutils) 5.3.0-20040812-FreeBSD Written by Mike Haertel and Paul Eggert. Copyright (C) 2004 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. $ locale LANG=en_GB.ISO8859-1 LC_CTYPE="en_GB.ISO8859-1" LC_COLLATE=C LC_TIME="en_GB.ISO8859-1" LC_NUMERIC="en_GB.ISO8859-1" LC_MONETARY="en_GB.ISO8859-1" LC_MESSAGES="en_GB.ISO8859-1" LC_ALL $ uname -a FreeBSD horus.parodius.com 7.2-STABLE FreeBSD 7.2-STABLE #0: Sat Jan 9 07:52:27 PST 2010 root@horus.sc1.parodius.com:/usr/obj/usr/src/sys/PDSMI_PLUS_RELENG_7_amd64 amd64 $ truncate -s10m a; truncate -s5m b; truncate -s800k c $ find a b c -ls | /usr/bin/sort -nk7,7 406132 1 -rw------- 1 jdc users 819200 10 Feb 01:13 c 406131 1 -rw------- 1 jdc users 5242880 10 Feb 01:13 b 406130 1 -rw------- 1 jdc users 10485760 10 Feb 01:13 a $ find a b c -ls | /usr/bin/sort -gk7,7 406132 1 -rw------- 1 jdc users 819200 10 Feb 01:13 c 406131 1 -rw------- 1 jdc users 5242880 10 Feb 01:13 b 406130 1 -rw------- 1 jdc users 10485760 10 Feb 01:13 a $ /usr/bin/sort --version sort (GNU coreutils) 5.3.0-20040812-FreeBSD Written by Mike Haertel and Paul Eggert. Copyright (C) 2004 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. $ locale LANG=en_GB.ISO8859-1 LC_CTYPE="en_GB.ISO8859-1" LC_COLLATE=C LC_TIME="en_GB.ISO8859-1" LC_NUMERIC="en_GB.ISO8859-1" LC_MONETARY="en_GB.ISO8859-1" LC_MESSAGES="en_GB.ISO8859-1" LC_ALL -- | Jeremy Chadwick jdc@parodius.com | | Parodius Networking http://www.parodius.com/ | | UNIX Systems Administrator Mountain View, CA, USA | | Making life hard for others since 1977. PGP: 4BD6C0CB |
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 cI 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
On 2010/02/10 17:58, 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 > % 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 aHi, here is a patch I've submitted about 4 years ago... http://www.freebsd.org/cgi/query-pr.cgi?pr=gnu/93566 -- Kazuaki ODA