From owner-svn-src-all@FreeBSD.ORG Thu Jan 7 16:29:11 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7EA71106568B; Thu, 7 Jan 2010 16:29:11 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail10.syd.optusnet.com.au (mail10.syd.optusnet.com.au [211.29.132.191]) by mx1.freebsd.org (Postfix) with ESMTP id 140AE8FC12; Thu, 7 Jan 2010 16:29:10 +0000 (UTC) Received: from c122-106-155-90.carlnfd1.nsw.optusnet.com.au (c122-106-155-90.carlnfd1.nsw.optusnet.com.au [122.106.155.90]) by mail10.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id o07GT78s004851 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 8 Jan 2010 03:29:09 +1100 Date: Fri, 8 Jan 2010 03:29:07 +1100 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Andrey Chernov In-Reply-To: <20100107050409.GA85573@nagual.pp.ru> Message-ID: <20100108030937.Q56559@delplex.bde.org> References: <201001052020.o05KKVEp002337@svn.freebsd.org> <20100107050409.GA85573@nagual.pp.ru> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Konstantin Belousov Subject: Re: svn commit: r201604 - head/lib/libc/gen X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2010 16:29:11 -0000 On Thu, 7 Jan 2010, Andrey Chernov wrote: > On Tue, Jan 05, 2010 at 08:20:31PM +0000, Konstantin Belousov wrote: >> * Alphabetic order comparison routine for those who want it. >> + * >> + * XXXKIB POSIX 2008 requires the alphasort() to use strcoll(). Keep >> + * strcmp() for now, since environment locale settings could have no >> + * relevance for the byte sequence of the file name. Moreover, it >> + * might be even invalid sequence in current locale, and then >> + * behaviour of alphasort would be undefined. >> */ > > This is wrong turn. Nothing has turned here yet. We just didn't want to risk changing alphasort() yet. > Exact the same can be said about text files: "environment locale > settings could have no relevance for the byte sequence of the text. > Moreover, it might be even invalid sequence in current locale, and then > behaviour of sort would be undefined". Despite of this, we use > localized sort in the system. > > You made result of something like 'ls | sort' and alphasort() differs. alphasort() has always used strcmp(). It became inconsistent with plain ls when you changed ls to use strcoll() in 2006. (ls has never used scandir() or alphasort() in FreeBSD; it uses fts). "| sort" might be useable to give the same ordering for both ls and utilities using alphasort(). POSIX adds an EINVAL error and a requirement that errno no be modified if there is no error, so that errors from strcoll() can be detected (still messily -- you have to set errno to != EINVAL before the call). Maybe falling back to strcmp() is good enough for the errnor handling. Bruce