From owner-cvs-all Thu Mar 1 13: 5:16 2001 Delivered-To: cvs-all@freebsd.org Received: from gw.nectar.com (gw.nectar.com [208.42.49.153]) by hub.freebsd.org (Postfix) with ESMTP id 67EFE37B718; Thu, 1 Mar 2001 13:05:07 -0800 (PST) (envelope-from nectar@nectar.com) Received: from hamlet.nectar.com (hamlet.nectar.com [10.0.1.102]) by gw.nectar.com (Postfix) with ESMTP id 77C9B18C91; Thu, 1 Mar 2001 15:05:04 -0600 (CST) Received: (from nectar@localhost) by hamlet.nectar.com (8.11.2/8.9.3) id f21L54l21037; Thu, 1 Mar 2001 15:05:04 -0600 (CST) (envelope-from nectar@spawn.nectar.com) Date: Thu, 1 Mar 2001 15:05:04 -0600 From: "Jacques A. Vidrine" To: Warner Losh , Garrett Wollman , cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/usr.bin/make arch.c main.c Message-ID: <20010301150504.A20983@hamlet.nectar.com> Mail-Followup-To: "Jacques A. Vidrine" , Warner Losh , Garrett Wollman , cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org References: <200103011743.MAA01724@khavrinen.lcs.mit.edu> <200103010603.f2163IM00616@freefall.freebsd.org> <200103011743.MAA01724@khavrinen.lcs.mit.edu> <200103011817.f21IHZd50132@harmony.village.org> <20010301145142.A20573@hamlet.nectar.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20010301145142.A20573@hamlet.nectar.com>; from n@nectar.com on Thu, Mar 01, 2001 at 02:51:42PM -0600 X-Url: http://www.nectar.com/ Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Thu, Mar 01, 2001 at 02:51:42PM -0600, Jacques A. Vidrine wrote: > On Thu, Mar 01, 2001 at 11:17:35AM -0700, Warner Losh wrote: > > In message <200103011743.MAA01724@khavrinen.lcs.mit.edu> Garrett Wollman writes: > > : < said: > > : > > : > MAXPATHLEN includes the trailing NUL. > > : > > : Should have also changed the code to use PATH_MAX instead of > > : MAXPATHLEN. > > > > OK. Can you give me a pointer to the definition of PATH_MAX in a > > standards doc so I do it right? > > ISO/IEC 9945-1:1996 (POSIX.1) sections 2.8.2, 2.8.5, and tables 2.3, > 2.6 give us this: > > {_POSIX_PATH_MAX} ``The number of bytes in a pathname.'' Must be > defined as 255 in . We have this already. > > {PATH_MAX} ``Maximum number of bytes in a pathname (not a string > length; count excludes a terminating null).'' Must be at least > {_POSIX_PATH_MAX} if defined in . We have this already > (via syslimits.h). > > On some systems, {PATH_MAX} may not be defined in , in which > case you either have to assume {_POSIX_PATH_MAX} or use pathconf() to > find the ``real'' value. This is to support the case where the > maximum path length can vary from one filesystem to another, for example. > > Note that {PATH_MAX} _does not_ include a terminating null, and that > in sys/param.h we define MAXPATHLEN = PATH_MAX. A quick look through > the sources reveals lots & lots of `bugs' due to this. > > Hope this helps. I got the information above from my hardcopy of IEC/ISO 9945-1:1996/ IEEE Std 1003.1 1996. Then I thought it would be a good idea if I posted a link to an online version, so I surfed off to www.opengroup.org to get a link to SUSv2. http://www.opengroup.org/onlinepubs/007908799/xsh/limits.h.html I'll be damned if SUSv2 doesn't contradict ISO 9945-1: It says ``PATH_MAX Maximum number of bytes in a pathname, including the terminating null character.'' I think this is SUSv2 bug. Stevens writes in 1993 that PATH_MAX does not include room for a null character, and his program fragments in APUE consistently use PATH_MAX + 1. Cheers, -- Jacques Vidrine / n@nectar.com / jvidrine@verio.net / nectar@FreeBSD.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message