retitle 900240 cmake: FTBFS on hurd-i386 due to a PATH_MAX issue 
thanks

Hello,

Currently cmake FTBFS on GNU/Hurd due to a PATH_MAX issue. Attached is
the patch path_max.patch also provided by the first attachment in this
bug #900240, there named path_max.path. With the attached patch and the
upcoming bug report on linux-any, providing
Source_Modules_FindLibUV.cmake.diff cmake builds fine. 

Thanks!
Index: cmake-3.11.2/Utilities/cmlibuv/src/unix/fs.c
===================================================================
--- cmake-3.11.2.orig/Utilities/cmlibuv/src/unix/fs.c
+++ cmake-3.11.2/Utilities/cmlibuv/src/unix/fs.c
@@ -427,6 +427,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;
 
@@ -442,12 +443,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) {
@@ -474,9 +482,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);
 
@@ -489,6 +504,7 @@ static ssize_t uv__fs_realpath(uv_fs_t*
     uv__free(buf);
     return -1;
   }
+#endif
 
   req->ptr = buf;
 

Reply via email to