Hmm.  Interesting problem.   The "realpath(3C)" documentation specifically
references PATH_MAX:

> NAME
>        realpath - return the canonicalized absolute pathname
> 
> SYNOPSIS
>        #include <limits.h>
>        #include <stdlib.h>
>        char *realpath(const char *path, char *resolved_path);
> [...]
> ERRORS
> [...]
>        ENAMETOOLONG
>               A component of a path name exceeded NAME_MAX characters,  or  an
>               entire path name exceeded PATH_MAX characters.

and the code in question is only compiled in if "realpath" is known
to be in the library.  And, yes, I know about the extended GNU doc:

> BUGS
>        Never  use this function. It is broken by design since it is impossible
>        to determine a suitable size for the output buffer.  According to POSIX
>        a  buffer of size PATH_MAX suffices, but PATH_MAX need not be a defined
>        constant, and may have to be obtained  using  pathconf().   And  asking
>        pathconf() does not really help, since on the one hand POSIX warns that
>        the result of pathconf() may be huge and unsuitable for mallocing  mem-
>        ory.  And  on  the  other hand pathconf() may return -1 to signify that
>        PATH_MAX is not bounded.

but since no viable alternative is suggested, it leaves one in a difficult
spot.  Especially since virtually all "normal" paths are under a few hundred
bytes and PATH_MAX is typically 1024.  If someone wants to promote an 
"realnpath"
call, I'd be a happy camper :).  Anyway, I'll replace "PATH_MAX" with 
"MAXPATHLEN"
and now define it thus:

#ifndef MAXPATHLEN
#  ifdef PATH_MAX
#    define MAXPATHLEN   PATH_MAX
#  else
#    define MAXPATHLEN   4096
#  endif
#else
#  if defined(PATH_MAX) && (PATH_MAX > MAXPATHLEN)
#     undef  MAXPATHLEN
#     define MAXPATHLEN  PATH_MAX
#  endif
#endif

Ugly stuff....

Thank you.  Regards, Bruce

On Monday 25 July 2005 09:29 am, Michael Banck wrote:
> Package: autogen
> Severity: important
> Version: 5.7-4
> Tags: patch
> 
> Sorry, I should have checked this before filing the last bug.  Due to a
> PATH_MAX occurance in autoopts/load.c, autogen FTBFS:
> 
>  gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I../autoopts -O2 -MT libopts.lo
> -MD -MP -MF .deps/libopts.Tpo -c libopts.c  -fPIC -DPIC -o
> .libs/libopts.o
> In file included from libopts.c:15:
> load.c: In function 'optionMakePath':
> load.c:225: error: 'PATH_MAX' undeclared (first use in this function)


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to