Subject: Re: FILENAME_MAX/MAXPATHLEN
To: Alistair Crooks <agc@pkgsrc.org>
From: David Laight <david@l8s.co.uk>
List: tech-pkg
Date: 12/22/2004 19:46:15
On Wed, Dec 22, 2004 at 11:17:18AM +0000, Alistair Crooks wrote:
> We'd like to add HP/UX to the list of supported platforms, but have
> run into an interesting issue to do with file name lengths.
> 
> The pkg_install code uses FILENAME_MAX in a lot of places to represent
> the full path name of a file.  Traditionally on BSD systems, this has
> been set to 1024 in stdio.h, and derives from the limit on FFS.
> MAXPATHLEN is 1024 (via PATH_MAX).
> 
> On HP/UX, it seems that FILENAME_MAX is 14, which relates to the V6
> filesystem limit.  This may also be the same as other System V derived
> Unices, it's been a while since I worked on them.  On HP/UX,
> MAXPATHLEN is 1024.
> 
> I'd like to replace all the occurrences of FILENAME_MAX in the
> pkg_install utilities with MAXPATHLEN.  This is for 2 reasons -
> MAXPATHLEN more accurately represents what the buffers will be used to
> hold, and I'd like the utilities to work on HP/UX.
> 
> If you have a system where MAXPATHLEN is less than FILENAME_MAX, or
> where this may cause a problem, could you let me know, please?

Should the code be using pathconf(2) ?

	David

-- 
David Laight: david@l8s.co.uk