Subject: Re: FILENAME_MAX/MAXPATHLEN
To: Alistair Crooks <agc@pkgsrc.org>
From: Georg Schwarz <georg.schwarz@freenet.de>
List: tech-pkg
Date: 12/22/2004 22:57:55
> We'd like to add HP/UX to the list of supported platforms, but have

maybe doing so you happen to remove some of the issues I'm facing on
IRIX 5.3...

> 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

so it does on IRIX 5.3

> been set to 1024 in stdio.h, and derives from the limit on FFS.
> MAXPATHLEN is 1024 (via PATH_MAX).

here too.

> 
> 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?

On IRIX 5.3 MAXPATHLEN seems to be defined in sys/param.h. It remains
to be seen whether this fact makes it necessary to include that header
file or whether it is included by other header files.

-- 
Georg Schwarz    http://home.pages.de/~schwarz/
 georg.schwarz@freenet.de  +49 177 8811442