bug-gnulib
[Top][All Lists]
Advanced

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

Re: PATH_MAX constant expression


From: Jim Meyering
Subject: Re: PATH_MAX constant expression
Date: Tue, 21 Jun 2011 06:51:46 +0200

Eric Blake wrote:

> On 06/20/2011 04:34 PM, Bruno Haible wrote:
>> I find it reasonable to use "#ifdef PATH_MAX" in front of every use of
>> PATH_MAX, like POSIX requires.
>>
>>> But later on in test-getcwd, we have code
>>> that does #ifndef PATH_MAX, which is no longer reachable because of our
>>> guarantee that PATH_MAX is always defined in pathmax.h.
>>
>> No, we don't want to guarantee a PATH_MAX on GNU/Hurd.
>>
>> Here's a proposed patch:
>>
>>
>> 2011-06-20  Bruno Haible  <address@hidden>
>>
>>      pathmax: Never define PATH_MAX to a non-constant expression.
>>      * lib/pathmax.h (PATH_MAX): Don't define in terms of pathconf.
>>      * m4/pathmax.m4 (gl_PATHMAX): Don't test for pathconf.
>
> Looks okay to me, but let's wait to see if anyone else also has an
> opinion.  Let's also enhance doc/posix-headers/limits.texi to mention
> the pathmax module and its (new) semantics of not interfering with Hurd.

coreutils has few remaining uses of PATH_MAX, but they do expect
pathmax.h to define it unconditionally, and from what I recall,
it has always worked that way.  Thus, changing it *not* to define
PATH_MAX on the Hurd would cause trouble.

In any case, it looks like your patch is ok, since the combination
of these two blocks ensures that PATH_MAX *is* always defined:

  # ifndef _POSIX_PATH_MAX
  #  define _POSIX_PATH_MAX 256
  # endif

  # ifndef PATH_MAX
  #  define PATH_MAX _POSIX_PATH_MAX
  # endif



reply via email to

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