Bug#669059: webkit-1.8.0-2: FTBFS on hurd-*

Samuel Thibault sthibault at debian.org
Mon Apr 16 20:30:48 UTC 2012


Svante Signell, le Mon 16 Apr 2012 22:20:20 +0200, a écrit :
> webkit currently FTBFS on hurd-i386, due to the usage of PATH_MAX,
> which is only recommended by POSIX, not mandatory,

It's not even recommanded. It's just needed when the limit exists, and
shall even not be defined when it depends on the path:

“ A definition of one of the symbolic constants in the following list
shall be omitted from the <limits.h> header on specific implementations
where the corresponding value is equal to or greater than the stated
minimum, but where the value can vary depending on the file to which it
is applied.”

> --- a/Source/JavaScriptCore/wtf/gobject/GlibUtilities.cpp	2012-02-19 18:45:45.000000000 +0100
> +++ b/Source/JavaScriptCore/wtf/gobject/GlibUtilities.cpp	2012-04-16 14:23:16.000000000 +0200
> @@ -25,6 +25,8 @@
>  #include <wtf/text/WTFString.h>
>  #else
>  #include <limits.h>
> +#include <sys/types.h>
> +#include <sys/stat.h>
>  #include <unistd.h>
>  #endif
>  
> @@ -40,9 +42,14 @@
>  #elif OS(UNIX)
>  CString getCurrentExecutablePath()
>  {
> -    static char readLinkBuffer[PATH_MAX];
> -    ssize_t result = readlink("/proc/curproc/file", readLinkBuffer, PATH_MAX);
> -    if (result == -1)
> +    struct stat sb;
> +    char *readLinkBuffer;

It does not seem to be the latest version of your patch after our
discussion on debian-hurd, as readLinkBuffer is here still not static,
and

> +    ssize_t result;
> +    result = lstat("/proc/curproc/file", &sb);
> +    readLinkBuffer = (char*)malloc(sb.st_size + 1);

that will leak on each call of getCurrentExecutablePath. You need to
test for existing previous static buffer and either just free it or check
whether its size is big enough, and reallocate if not.

> +    if (readLinkBuffer == NULL) return CString();
> +    result = readlink("/proc/curproc/file", readLinkBuffer, sb.st_size + 1);
> +    if (result == -1 || result > sb.st_size)
>          return CString();
>      return CString(readLinkBuffer, result);
>  }

Samuel





More information about the Pkg-webkit-maintainers mailing list