From owner-svn-src-head@FreeBSD.ORG Sun Jun 27 16:31:51 2010 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 79679106566B; Sun, 27 Jun 2010 16:31:51 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail02.syd.optusnet.com.au (mail02.syd.optusnet.com.au [211.29.132.183]) by mx1.freebsd.org (Postfix) with ESMTP id 08D2E8FC13; Sun, 27 Jun 2010 16:31:50 +0000 (UTC) Received: from c122-107-125-7.carlnfd1.nsw.optusnet.com.au (c122-107-125-7.carlnfd1.nsw.optusnet.com.au [122.107.125.7]) by mail02.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id o5RGVlpp022132 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 28 Jun 2010 02:31:48 +1000 Date: Mon, 28 Jun 2010 02:31:46 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Garrett Cooper In-Reply-To: Message-ID: <20100628012949.I49091@delplex.bde.org> References: <201006262144.o5QLi5tF076622@svn.freebsd.org> MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="0-920043072-1277656306=:49091" Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Pawel Jakub Dawidek Subject: Re: svn commit: r209542 - head/lib/libc/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jun 2010 16:31:51 -0000 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --0-920043072-1277656306=:49091 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE On Sat, 26 Jun 2010, Garrett Cooper wrote: Please fix your mail program to not mangle the message with \xa0's. > On Sat, Jun 26, 2010 at 2:44 PM, Pawel Jakub Dawidek wr= ote: >> Log: >> =A0Just like in case of setgroups(2), for getgroups(2) also advice inclu= ding >> =A0sys/param.h instead of sys/types.h so we get NGROUPS_MAX and NGROUPS >> =A0definitions. This bug should have been fixed in getgroups.2, not duplicated. It was fixed in getgroups.2 in 1998, but not in setgroups, presumably because POSIX only specified getgroups back then: % RCS file: /home/ncvs/src/lib/libc/sys/getgroups.2,v % Working file: getgroups.2 % head: 1.12 % ---------------------------- % revision 1.3 % date: 1998/01/11 22:01:20; author: alex; state: Exp; lines: +9 -1 % Replace sys/param.h with sys/types.h as per POSIX. % Document the special case of gidsetlen =3D=3D 0. %=20 % Partially obtained from: OpenBSD % ---------------------------- This is a bug because: - neither NGROUPS_MAX nor NGROUPS is needed to use get/setgroups(). These functions take an int arg which may be unrelated to the maximum number of groups - all uses of NGROUPS_MAX and NGROUPS are bugs, since they are fixed values so using them breaks binary compatibility - FreeBSD was fixed relatively recently to never (?) use NGROUPS_MAX or NGROUPS. The fixes include removing the reference to NGROUPS max in getgroups.2 and the reference to NGROUPS in setgroups.2. Now {NGROUPS_MAX}+1 is used consistently. This cannot be found in . (It's documentation seems to be unfindable in any, man page but that is another bug. POSIX limits should be described somewhere like intro.2 and intro.2 should not be cross referenced to.) > Hmmm... looks like our copy of getgroups(2) is not POSIX compliant > then :/ : http://www.opengroup.org/onlinepubs/000095399/functions/getgrou= ps.html It only used to be, after the 1998 fix. POSIX didn't have setgroups() in 2001 either. > . Why not just use sysconf like the POSIX page suggests (which is > portable)? FreeBSD's man page says this too (implicitly via the {} markup). POSIX has an explicit example using sysconf(). I prefer not to have such examples in individual man pages. They are difficult to give in enough detail to work in general. POSIX has very wrong examples for use of {LINE_MAX}. Its example for {NGROUPS_MAX} for getgroups() is little better -- it is missing an include of to declare malloc(), and has no error handling. I would prefer a central example that is missing these bugs but describes the shortcuts of having them. Bruce --0-920043072-1277656306=:49091--