From owner-svn-src-all@FreeBSD.ORG Tue Jan 19 14:42:12 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 C8D4E106566B; Tue, 19 Jan 2010 14:42:12 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail05.syd.optusnet.com.au (mail05.syd.optusnet.com.au [211.29.132.186]) by mx1.freebsd.org (Postfix) with ESMTP id 5BF4C8FC17; Tue, 19 Jan 2010 14:42:11 +0000 (UTC) Received: from c220-239-227-214.carlnfd1.nsw.optusnet.com.au (c220-239-227-214.carlnfd1.nsw.optusnet.com.au [220.239.227.214]) by mail05.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id o0JEg8Gk004687 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 20 Jan 2010 01:42:10 +1100 Date: Wed, 20 Jan 2010 01:42:08 +1100 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: "Andrey A. Chernov" In-Reply-To: <201001181344.o0IDiiEL079037@svn.freebsd.org> Message-ID: <20100120012639.B67517@delplex.bde.org> References: <201001181344.o0IDiiEL079037@svn.freebsd.org> 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 Subject: Re: svn commit: r202572 - 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: Tue, 19 Jan 2010 14:42:12 -0000 On Mon, 18 Jan 2010, Andrey A. Chernov wrote: > Log: > Double checking my commit I found that comment saying that > POSIX 2008 and XSI 7require strcoll() for opendir() is not true. > I can't find such requirement in POSIX 2008 and XSI 7. The comment was correct. It says that POSIX requires strcoll() for alphasort(), not for opendir(). Since opendir() is not alphasort(), and it wants plain ASCII sorting to support union file systems, it intentionally doesn't use either alphasort() or strcoll(). > So, back out that part of my commit, returning old strcmp(), and remove > this misleading comment. > > Modified: > head/lib/libc/gen/opendir.c > > Modified: head/lib/libc/gen/opendir.c > ============================================================================== > --- head/lib/libc/gen/opendir.c Mon Jan 18 13:38:45 2010 (r202571) > +++ head/lib/libc/gen/opendir.c Mon Jan 18 13:44:44 2010 (r202572) > @@ -92,15 +92,11 @@ __opendir2(const char *name, int flags) > return __opendir_common(fd, name, flags); > } > > -/* > - * POSIX 2008 and XSI 7 require alphasort() to call strcoll() for > - * directory entries ordering. > - */ Was correct, but it could have been clearer by saying ", so opendir() uses this comparison function instead of alphasort()". > static int > -opendir_alphasort(const void *p1, const void *p2) > +opendir_sort(const void *p1, const void *p2) I forget what the old name was. Having alphasort in the name here was wrong 3 layers deep, since this is not alphasort(), and alphasort() is not an alpha sorting function -- it is a lexicographically-on-the-whole- character-set comparison function. fts's internal comparison function is named correctly -- fts_compar. > { > > - return (strcoll((*(const struct dirent **)p1)->d_name, > + return (strcmp((*(const struct dirent **)p1)->d_name, > (*(const struct dirent **)p2)->d_name)); Now correct (was broken by previous commit). > } > > @@ -253,7 +249,7 @@ __opendir_common(int fd, const char *nam > * This sort must be stable. > */ > mergesort(dpv, n, sizeof(*dpv), > - opendir_alphasort); > + opendir_sort); Correct modulo the name. > > dpv[n] = NULL; > xp = NULL; > New bug in a comment in scandir(): now has an extra blank line, due to partial removal. Bruce