[Pkg-cmake-team] Bug#900240: Info received (cmake: FTBFS on hurd-i386)

Petter Reinholdtsen pere at hungry.com
Sun Aug 12 09:43:21 BST 2018


Sorry, I just noticed I sent the wrong patch.  Here is the correct
patch.

Index: cmake-3.12.1/Utilities/cmlibuv/src/unix/fs.c
===================================================================
--- cmake-3.12.1.orig/Utilities/cmlibuv/src/unix/fs.c
+++ cmake-3.12.1/Utilities/cmlibuv/src/unix/fs.c
@@ -426,6 +426,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;
 
@@ -441,41 +442,52 @@ static ssize_t uv__fs_pathmax_size(const
 
   return pathmax;
 }
+#endif
 
 static ssize_t uv__fs_readlink(uv_fs_t* req) {
+  ssize_t size = 1024;
   ssize_t len;
   char* buf;
+  while (1) {
+    buf = uv__malloc(size + 1);
 
-  len = uv__fs_pathmax_size(req->path);
-  buf = uv__malloc(len + 1);
-
-  if (buf == NULL) {
-    errno = ENOMEM;
-    return -1;
-  }
+    if (buf == NULL) {
+      errno = ENOMEM;
+      return -1;
+    }
 
 #if defined(__MVS__)
-  len = os390_readlink(req->path, buf, len);
+    len = os390_readlink(req->path, buf, size);
 #else
-  len = readlink(req->path, buf, len);
+    len = readlink(req->path, buf, size);
 #endif
 
-
-  if (len == -1) {
-    uv__free(buf);
-    return -1;
+    if (len == -1) {
+      uv__free(buf);
+      return -1;
+    }
+
+    if (len < size) {
+      buf[len] = '\0';
+      req->ptr = buf;
+      return 0;
+    }
+    free(buf);
+    size *= 2;
   }
-
-  buf[len] = '\0';
-  req->ptr = buf;
-
-  return 0;
 }
 
 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);
 
@@ -488,6 +500,7 @@ static ssize_t uv__fs_realpath(uv_fs_t*
     uv__free(buf);
     return -1;
   }
+#endif
 
   req->ptr = buf;
 

-- 
Happy hacking
Petter Reinholdtsen



More information about the Pkg-cmake-team mailing list