NetBSD Problem Report #43222

From jruohone@gmail.com  Thu Apr 29 08:30:10 2010
Return-Path: <jruohone@gmail.com>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id 9BEB963B8FE
	for <gnats-bugs@gnats.netbsd.org>; Thu, 29 Apr 2010 08:30:10 +0000 (UTC)
Message-Id: <20100429080121.CEA6A2A59@marx.bitnet>
Date: Thu, 29 Apr 2010 11:01:21 +0300 (EEST)
From: Jukka Ruohonen <jruohonen@iki.fi>
Sender: a b <jruohone@gmail.com>
Reply-To: jruohonen@iki.fi
To: gnats-bugs@gnats.NetBSD.org
Subject: alphasort(3) confusion
X-Send-Pr-Version: 3.95

>Number:         43222
>Category:       lib
>Synopsis:       alphasort(3) confusion
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Apr 29 08:35:00 +0000 2010
>Originator:     Jukka Ruohonen
>Release:        NetBSD 5.0_STABLE - 5.99.27
>Organization:
-
>Environment:
>Description:

The scandir(3) and alphasort(3) functions appeared recently in POSIX-2008.
In NetBSD the alphasort(3) is however prototyped as:

	int
	alphasort(const void *d1, const void *d2);

While on other systems (namely, Linux and FreeBSD), and in the standard, it
is specified more precisely as

	int
	alphasort(const struct dirent **d1, const struct dirent **d2);

>How-To-Repeat:

man alphasort(3), code inspection.

See also:

http://www.opengroup.org/onlinepubs/9699919799/functions/alphasort.html

From the FreeBSD CVS commit:

revision 1.10
date: 2010/01/04 15:40:17;  author: kib;  state: Exp;  lines: +3 -4
SVN rev 201512 on 2010-01-04 15:40:17Z by kib

Modernize scandir(3) and alphasort(3) interfaces according to the IEEE
Std 1003.1-2008. Both Linux and Solaris conforms to the new definitions,
so we better follow too (older glibc used old BSDish alphasort prototype
and corresponding type of the comparision function for scandir). While
there, change the definitions of the functions to ANSI C and fix several
style issues nearby.

Remove requirement for "sys/types.h" include for functions from manpage.

POSIX also requires that alphasort(3) sorts as if strcoll(3) was used,
but leave the strcmp(3) call in the function for now.

Adapt in-tree callers of scandir(3) to new declaration. The fact that
select_sections() from catman(1) could modify supplied struct dirent is
a bug.

PR:     standards/142255
MFC after:      2 weeks

>Fix:

Either change the prototype or close this as irrelevant.

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.