[jira] [Commented] (DAEMON-294) Compilation fails on GNU Hurd

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[jira] [Commented] (DAEMON-294) Compilation fails on GNU Hurd

Alex Herbert (Jira)

    [ https://issues.apache.org/jira/browse/DAEMON-294?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13628994#comment-13628994 ]

Emmanuel Bourg commented on DAEMON-294:

Also, from the GNU Hurd Porting Guidelines:


{quote}Every unconditionalized use of PATH_MAX, MAX_PATH or MAXPATHLEN is a POSIX incompatibility. If there is no upper limit on the length of a path (as its the case for GNU), this symbol is not defined in any header file. Instead, you need to either use a different implementation that does not rely on the length of a string or use sysconf() to query the length at runtime. If sysconf() returns -1, you have to use realloc() to allocate the needed memory dynamically. Usually it is thus simpler to just use dynamic allocation. Sometimes the amount is actually known. Else, a geometrically growing loop can be used: for instance, see [Alioth patch|http://alioth.debian.org/tracker/download.php/30628/410472/303735/1575/cpulimit-path-max-fix.patch] or [Pulseaudio patch|http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=5;filename=patch-pulse;att=1;bug=522100]. Note that in some cases there are GNU extensions that just work fine: when the __GLIBC__ macro is defined, getcwd() calls can be just replaced by get_current_dir_name() calls.

Note: constants such as _POSIX_PATH_MAX are only the minimum required value for a potential corresponding PATH_MAX macro. They are not a replacement for PATH_MAX, just the minimum value that one can assume.

Note 2: Yes, some POSIX functions such as realpath() actually assume that PATH_MAX is defined. This is a bug of the POSIX standard, which got fixed in the latest revisions, in which one can simply pass NULL to get a dynamically allocated buffer.{quote}

> Compilation fails on GNU Hurd
> -----------------------------
>                 Key: DAEMON-294
>                 URL: https://issues.apache.org/jira/browse/DAEMON-294
>             Project: Commons Daemon
>          Issue Type: Bug
>    Affects Versions: 1.0.10
>            Reporter: Emmanuel Bourg
>            Priority: Minor
> The compilation of Commons Daemon fails on GNU Hurd as reported by the buildd instance used by Debian. It breaks with the following error:
> {code}arguments.c:61:17: error: 'PATH_MAX' undeclared (first use in this function){code}
> The full report is available here:
> https://buildd.debian.org/status/package.php?p=commons-daemon
> https://buildd.debian.org/status/fetch.php?pkg=commons-daemon&arch=hurd-i386&ver=1.0.10-3&stamp=1345183045

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira