From owner-freebsd-standards@FreeBSD.ORG Sun Aug 8 20:01:24 2010 Return-Path: Delivered-To: standards@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8936F106566B for ; Sun, 8 Aug 2010 20:01:24 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id 16D418FC12 for ; Sun, 8 Aug 2010 20:01:23 +0000 (UTC) Received: by bwz9 with SMTP id 9so1073104bwz.13 for ; Sun, 08 Aug 2010 13:01:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=PxZW19DnYR/ixPfy7KuFQrndsAERZ13Hotq/b+JfLHY=; b=TRRiuoMQw/ZKHNwtvCcAXphTtA1WiXiM6+d09Ei54zBwRP24St22y9TUbEw4mLxsa1 hmJWWgOhl+3Kc4Q7Fg43FOQb4LieFB2ytzWRJAPBPQp1psmSprj+tZ4gP1ng+y7Z+nWG pic4yQoz7QSuleAYVfoP6WURTGAgmjVQOW800= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=U1o+7eftynEWl6/HtTW9hkfvMtWHxKKZpDPFQBsmLcQooXljH78Y4fkY/UVKzPE03P nGaz0xsKTBTbvrJXBP6hlpW6as8eluTzDyzbc38cKvl1EtTDAA0jFEuNIOstz7FCl6FK XdJL3NAihb0ER+ninUQ/wZm03GA97OzT31V6U= MIME-Version: 1.0 Received: by 10.204.131.200 with SMTP id y8mr9986887bks.107.1281297677092; Sun, 08 Aug 2010 13:01:17 -0700 (PDT) Received: by 10.204.117.78 with HTTP; Sun, 8 Aug 2010 13:01:17 -0700 (PDT) In-Reply-To: References: Date: Sun, 8 Aug 2010 13:01:17 -0700 Message-ID: From: Garrett Cooper To: standards@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: Subject: Re: Confusion over wording in glob(3) X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Aug 2010 20:01:24 -0000 On Mon, Aug 2, 2010 at 12:35 AM, Garrett Cooper wrote: > =A0 =A0I have some question about the ambiguity of the ERRORS section in > our glob(3) manpage. > > POSIX states: > > ERRORS > > =A0 =A0The glob() function shall fail and return the corresponding value = if: > > =A0 =A0GLOB_ABORTED > =A0 =A0 =A0 =A0The scan was stopped because GLOB_ERR was set or (*errfunc= ()) > returned non-zero. > =A0 =A0GLOB_NOMATCH > =A0 =A0 =A0 =A0The pattern does not match any existing pathname, and > GLOB_NOCHECK was not set in flags. > =A0 =A0GLOB_NOSPACE > =A0 =A0 =A0 =A0An attempt to allocate memory failed. > > (Note that there's no mention of `errno'). > Our manpage states: > > =A0 =A0 If glob() terminates due to an error, it sets errno and returns o= ne of > =A0 =A0 the following non-zero constants, which are defined in the includ= e file > =A0 =A0 : > > =A0 =A0 GLOB_NOSPACE =A0An attempt to allocate memory failed, or if errno= was 0 > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 GLOB_LIMIT was specified in the flags= and pglob->gl_matchc > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 or more patterns were matched. > > =A0 =A0 GLOB_ABORTED =A0The scan was stopped because an error was encount= ered and > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 either GLOB_ERR was set or (*errfunc)= () returned non-zero. > > =A0 =A0 GLOB_NOMATCH =A0The pattern did not match a pathname and GLOB_NOC= HECK was > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 not set. > > (Note the mention of errno). > So far I've only been able to hit a sensical error case once by doing > the following (but that could have been a side-effect from a malloc(3) > failure in terms of finding malloc.conf -- don't know for sure). The > rest of the time I get errno =3D 0: > > $ cc -o test_glob test_glob.c > $ ln -f test_glob test_glob_nomatch > $ ./test_glob_nomatch > NOMATCH > glob(./test_glob_nomatch.*) didn't match: 0: Unknown error: 0 > > So I suppose my question is: should the confusing wording be removed > for clarity? Looking over the manpages a bit more closely, it might help if I had specified GLOB_ERR -- but it would help if that was spelled out more clearly in the manpage (I tend to skim to the bottom of manpages for the error and return code sections, so I missed that point). Thanks! -Garrett