[Pkg-javascript-devel] Bug#897061: libuv1: FTBFS on hurd-i386: PATH_MAX undefined (and kfreebsd as well)

Samuel Thibault sthibault at debian.org
Mon May 14 22:23:18 BST 2018


Hello,

Dominique Dumont, le mer. 09 mai 2018 15:47:29 +0200, a ecrit:
> On vendredi 27 avril 2018 21:39:04 CEST Samuel Thibault wrote:
> > libuv1 currently FTBFS on hurd-i386 because it unconditionally uses
> > PATH_MAX. The attached patch fixes this.
> > 
> > Also, the symbols file is only accurate for the Linux port, here is a
> > fix for that too.  Some symbols are really Linux-only in the source
> > code, they pose problem on kfreebsd as seen in buildd logs, so the patch
> > should fix the build there too.
> 
> I've applied both patches to libuv1 [1] . This will be uploaded with libuv1 
> 1.20.3 

Oops, it seems I missed some of my changes in the patch.  Here is a
fixed patch.

Samuel
-------------- next part --------------
Index: libuv1/src/unix/fs.c
===================================================================
--- libuv1.orig/src/unix/fs.c
+++ libuv1/src/unix/fs.c
@@ -416,6 +416,7 @@ static ssize_t uv__fs_scandir(uv_fs_t* r
 }
 
 
+#if _POSIX_VERSION < 200809L
 static ssize_t uv__fs_pathmax_size(const char* path) {
   ssize_t pathmax;
 
@@ -431,12 +432,19 @@ static ssize_t uv__fs_pathmax_size(const
 
   return pathmax;
 }
+#endif
 
 static ssize_t uv__fs_readlink(uv_fs_t* req) {
   ssize_t len;
   char* buf;
+  struct stat st;
+  int ret;
 
-  len = uv__fs_pathmax_size(req->path);
+  ret = lstat(req->path, &st);
+  if (ret != 0) {
+    return -1;
+  }
+  len = st.st_size;
   buf = uv__malloc(len + 1);
 
   if (buf == NULL) {
@@ -463,9 +471,16 @@ static ssize_t uv__fs_readlink(uv_fs_t*
 }
 
 static ssize_t uv__fs_realpath(uv_fs_t* req) {
-  ssize_t len;
   char* buf;
 
+#if _POSIX_VERSION >= 200809L
+  buf = realpath(req->path, NULL);
+  if (buf == NULL) {
+    return -1;
+  }
+#else
+  ssize_t len;
+
   len = uv__fs_pathmax_size(req->path);
   buf = uv__malloc(len + 1);
 
@@ -478,6 +493,7 @@ static ssize_t uv__fs_realpath(uv_fs_t*
     uv__free(buf);
     return -1;
   }
+#endif
 
   req->ptr = buf;
 


More information about the Pkg-javascript-devel mailing list