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

Bug#562176: luatex: FTBFS on hurd-i386: unconditional PATH_MAX usage



Hi Taco, 

Pino (in cc) found that luatex does not build on GNU/Hurd, but some
simple changes does fix that.

You might add that to luatex itself. (patch attached)

Thanks a lot and all the best

Norbert

On Mi, 23 Dez 2009, Pino Toscano wrote:
> Hi,
> 
> currently[1] luatex does not build on GNU/Hurd.
> The problem is the unconditional usage of PATH_MAX.
> The attached patch solves the issue, malloc'ing the buffers as needed.
> It also adds a small bit to "recognize" the GNU platform.
> 
> [1] https://buildd.debian.org/fetch.cgi?pkg=luatex&arch=hurd-i386&ver=0.47.0-1&stamp=1261470395&file=log&as=raw
> 
> Thanks,
> -- 
> Pino


Best wishes

Norbert
------------------------------------------------------------------------
Norbert Preining            preining@{jaist.ac.jp, logic.at, debian.org}
JAIST, Japan            TU Wien, Austria           Debian TeX Task Force
DSA: 0x09C5B094   fp: 14DF 2E6C 0307 BE6D AD76  A9C0 D2BF 4AA3 09C5 B094
------------------------------------------------------------------------
`... then I decided that I was a lemon for a couple of
weeks. I kept myself amused all that time jumping in and
out of a gin and tonic.'
Arthur cleared his throat, and then did it again.
did you...?'
I found a
small lake that thought it was a gin and tonic, and jumped
in and out of that. At least, I think it thought it was a
gin and tonic.'
`I may,' he addded with a grin which would have sent sane
men scampering into the trees, `have been imagining it.'
                 --- Ford updating Arthur about what he's been doing for the
                 --- past four years.
                 --- Douglas Adams, The Hitchhikers Guide to the Galaxy
--- a/source/texk/web2c/luatexdir/lua/loslibext.c
+++ b/source/texk/web2c/luatexdir/lua/loslibext.c
@@ -81,6 +81,9 @@
 #  elif defined(__MACH__) && defined(__APPLE__)
 #    undef OS_PLATNAME
 #    define OS_PLATNAME "macosx"
+#  elif defined(__GNU__)
+#    undef OS_PLATNAME
+#    define OS_PLATNAME "gnu"
 #  endif
 #endif
 
@@ -117,7 +120,7 @@
 
 static int exec_command(const char *file, char *const *argv, char *const *envp)
 {
-    char path[PATH_MAX];
+    char *path;
     const char *searchpath, *esp;
     size_t prefixlen, filelen, totallen;
 
@@ -125,6 +128,7 @@
         return execve(file, argv, envp);
 
     filelen = strlen(file);
+    path = NULL;
 
     searchpath = getenv("PATH");
     if (!searchpath)
@@ -141,14 +145,20 @@
 
         if (prefixlen == 0 || searchpath[prefixlen - 1] == '/') {
             totallen = prefixlen + filelen;
+#ifdef PATH_MAX
             if (totallen >= PATH_MAX)
                 continue;
+#endif
+            path = malloc(totallen + 1);
             memcpy(path, searchpath, prefixlen);
             memcpy(path + prefixlen, file, filelen);
         } else {
             totallen = prefixlen + filelen + 1;
+#ifdef PATH_MAX
             if (totallen >= PATH_MAX)
                 continue;
+#endif
+            path = malloc(totallen + 1);
             memcpy(path, searchpath, prefixlen);
             path[prefixlen] = '/';
             memcpy(path + prefixlen + 1, file, filelen);
@@ -156,6 +166,8 @@
         path[totallen] = '\0';
 
         execve(path, argv, envp);
+        free(path);
+        path = NULL;
         if (errno == E2BIG || errno == ENOEXEC ||
             errno == ENOMEM || errno == ETXTBSY)
             break;              /* Report this as an error, no more search */

Reply to: