Date: Thu, 7 Jan 2010 08:04:10 +0300 From: Andrey Chernov <ache@nagual.pp.ru> To: Konstantin Belousov <kib@FreeBSD.ORG> Cc: svn-src-head@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, src-committers@FreeBSD.ORG Subject: Re: svn commit: r201604 - head/lib/libc/gen Message-ID: <20100107050409.GA85573@nagual.pp.ru> In-Reply-To: <201001052020.o05KKVEp002337@svn.freebsd.org> References: <201001052020.o05KKVEp002337@svn.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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. 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. Please use strcoll() as POSIX said. It is user responsibility to set correct locale for non-suid programs, and for suid ones locale can't be set by user. -- http://ache.pp.ru/
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100107050409.GA85573>