From owner-freebsd-stable@FreeBSD.ORG Wed Feb 10 18:05:37 2010 Return-Path: Delivered-To: stable@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B8D461065672; Wed, 10 Feb 2010 18:05:37 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from acme.spoerlein.net (acme.spoerlein.net [IPv6:2001:470:9a47::1]) by mx1.freebsd.org (Postfix) with ESMTP id 3A3ED8FC19; Wed, 10 Feb 2010 18:05:37 +0000 (UTC) Received: from acme.spoerlein.net (localhost.spoerlein.net [IPv6:::1]) by acme.spoerlein.net (8.14.4/8.14.4) with ESMTP id o1AI5awB019391 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 10 Feb 2010 19:05:36 +0100 (CET) (envelope-from uqs@FreeBSD.org) Received: (from uqs@localhost) by acme.spoerlein.net (8.14.4/8.14.4/Submit) id o1AI5abb019390; Wed, 10 Feb 2010 19:05:36 +0100 (CET) (envelope-from uqs@FreeBSD.org) Date: Wed, 10 Feb 2010 19:05:35 +0100 From: Ulrich =?utf-8?B?U3DDtnJsZWlu?= To: Ruslan Ermilov Message-ID: <20100210180535.GG9748@acme.spoerlein.net> Mail-Followup-To: Ruslan Ermilov , stable@freebsd.org References: <20100210085814.GE9748@acme.spoerlein.net> <20100210104904.GA85373@edoofus.dev.vega.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20100210104904.GA85373@edoofus.dev.vega.ru> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: stable@FreeBSD.org Subject: Re: numeric sort(1) is broken on -STABLE X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Feb 2010 18:05:37 -0000 On Wed, 10.02.2010 at 13:49:05 +0300, Ruslan Ermilov wrote: > 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? Yes and no. LC_NUMERIC is still at C, LC_CTYPE is set to UTF-8, but as there are no non-ASCII symbols in that output it shouldn't matter, right? For me, 819200 is smaller than 10485760 in pretty much all locales. Why the hell is a numeric gnusort locale dependant? Why is -g working anyway? % locale LANG= LC_CTYPE=de_DE.UTF-8 LC_COLLATE="C" LC_TIME="C" LC_NUMERIC="C" LC_MONETARY="C" LC_MESSAGES="C" LC_ALL= % find a b c -ls | LC_ALL=C sort -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 Great, now I'm even more angry at sort(1) than before ... Regards, Uli