bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-gnulib] lib/pathmax.h


From: Paul Eggert
Subject: Re: [Bug-gnulib] lib/pathmax.h
Date: Mon, 23 Dec 2002 10:13:10 -0800

> Date: Mon, 23 Dec 2002 08:07:21 -0800
> From: Jeff Bailey <address@hidden>
> User-Agent: Mutt/1.3.28i
> 
> I'm concerned that lib/pathmax.h might be limiting on some systems - I
> don't know about many others, but certainly i386-pc-gnu doesn't define
> pathmax intentionally because there isn't a fixed system-wide limitation
> (limitations are implemented per filesystem)

PATH_MAX normally should not be used in portable programs, because the
macro is not defined on systems that do not have a limit.  (The Hurd
is such a system.)  Also, PATH_MAX might in theory equal LONG_MAX, so
it's a bit dicey to declare an array of size PATH_MAX.

As I understand it, lib/pathmax.h is an attempt to specify a macro
that is a useful size for initial allocations of buffers that contain
file names.  However, any such buffer should be extensible.
Personally, I avoid lib/pathmax.h since it's a portability hassle;
it's easier to declare a buffer of size (say) 1024 and then reallocate
it if it turns out to be too small.  You can use _POSIX_PATH_MAX or
_XOPEN_PATH_MAX if you prefer symbolic constants to "1024".

> Is pathconf universally available?

Unfortunately not.

> If no, I can put together an implementation of that (basically that
> just always returns either PATH_MAX or 255).  Otherwise under the
> current setup, we're always limiting systems that could legitly
> handle more for some filesystems.

What "current setup" are you thinking of?  I don't see the bug in
lib/pathmax.h itself.  But perhaps it is not being used correctly
somewhere?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]