Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Jan 2010 15:18:28 +0300
From:      Andrey Chernov <ache@nagual.pp.ru>
To:        Bruce Evans <brde@optusnet.com.au>
Cc:        svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org
Subject:   Re: svn commit: r202572 - head/lib/libc/gen
Message-ID:  <20100120121827.GA55236@nagual.pp.ru>
In-Reply-To: <20100120211722.S2451@besplex.bde.org>
References:  <201001181344.o0IDiiEL079037@svn.freebsd.org> <20100120012639.B67517@delplex.bde.org> <20100120070843.GA45937@nagual.pp.ru> <20100120191752.Q2120@besplex.bde.org> <20100120094627.GA53020@nagual.pp.ru> <20100120211722.S2451@besplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Jan 20, 2010 at 09:33:08PM +1100, Bruce Evans wrote:
> > But there is
> > nothing said about opendir() & strcoll() relation in the mentioned
> > standards. The only word I found is that opendir() returns "ordered"
> > sequence, but nowhere mentioned ordered by what criteria, so perhaps they
> > mean "stable":
> 
> As I said before, sorting in opendir() has nothing to do with POSIX!  It
> is an implementation detail for union file systems/mounts.

Moreover, even sorting itself is not required here. We sort just to remove 
dups.

> It should also give the FreeBSD
> extension of POSIX.  POSIX says: "If the strcoll() function fails,
> then the return value of alphasort() is unspecified.", but this makes
> alphasort() unusable since a qsort() comparison function must return
> a specified value.

To be used in practice, strcoll() should never fails, doing fallback to 
strcmp() instead, not only in that, but in lots of other cases too (it may 
set errno like EILSEQ, but not fails). The next important thing is to 
return 0 only for true binary equals, additionaly ranking (f.e. by 
strcmp()) anything inside classes of equality to stabilize result.

I hope our strcoll() will be kept in that state after implementing 
UCA too.

-- 
http://ache.pp.ru/



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