guix-commits
[Top][All Lists]
Advanced

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

01/01: gnu: patch: Set PATH_MAX for Hurd systems.


From: Manolis Fragkiskos Ragkousis
Subject: 01/01: gnu: patch: Set PATH_MAX for Hurd systems.
Date: Fri, 12 Jun 2015 12:52:20 +0000

phant0mas pushed a commit to branch core-updates
in repository guix.

commit 16cae799dbddc621026c230d058e0317db0a1b95
Author: Manolis Ragkousis <address@hidden>
Date:   Mon Jun 8 16:19:58 2015 +0300

    gnu: patch: Set PATH_MAX for Hurd systems.
    
    * gnu/packages/patches/patch-hurd-path-max.patch: New file.
    * gnu-system.am (dist_patch_DATA): Add it.
---
 gnu-system.am                                  |    1 +
 gnu/packages/base.scm                          |    3 +-
 gnu/packages/patches/patch-hurd-path-max.patch |   48 ++++++++++++++++++++++++
 3 files changed, 51 insertions(+), 1 deletions(-)

diff --git a/gnu-system.am b/gnu-system.am
index 206c876..5f2b6d9 100644
--- a/gnu-system.am
+++ b/gnu-system.am
@@ -505,6 +505,7 @@ dist_patch_DATA =                                           
\
   gnu/packages/patches/patchelf-page-size.patch                        \
   gnu/packages/patches/patchelf-rework-for-arm.patch           \
   gnu/packages/patches/patchutils-xfail-gendiff-tests.patch    \
+  gnu/packages/patches/patch-hurd-path-max.patch               \
   gnu/packages/patches/pavucontrol-sigsegv.patch               \
   gnu/packages/patches/perl-gd-options-passthrough-and-fontconfig.patch \
   gnu/packages/patches/perl-module-pluggable-search.patch      \
diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index 091e2f5..fa7c9e8 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -161,7 +161,8 @@ standard utility.")
                                   version ".tar.xz"))
               (sha256
                (base32
-                "16d2r9kpivaak948mxzc0bai45mqfw73m113wrkmbffnalv1b5gx"))))
+                "16d2r9kpivaak948mxzc0bai45mqfw73m113wrkmbffnalv1b5gx"))
+              (patches (list (search-patch "patch-hurd-path-max.patch")))))
    (build-system gnu-build-system)
    (native-inputs `(("ed", ed)))
    (synopsis "Apply differences to originals, with optional backups")
diff --git a/gnu/packages/patches/patch-hurd-path-max.patch 
b/gnu/packages/patches/patch-hurd-path-max.patch
new file mode 100644
index 0000000..81e3793
--- /dev/null
+++ b/gnu/packages/patches/patch-hurd-path-max.patch
@@ -0,0 +1,48 @@
+See <http://lists.gnu.org/archive/html/bug-patch/2015-06/msg00009.html>
+
+From 0507dfad5f060161f01840067e1bb1615257b636 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= <address@hidden>
+Date: Mon, 8 Jun 2015 17:27:56 +0200
+Subject: [PATCH] Do not rely on PATH_MAX when reading a symlink target.
+
+* src/util.c (move_file, copy_file): Use 'fromst->st_size + 1' and
+'tost->st_size + 1' for the allocation, and 'fromst->st_size' and
+'tost->st_size' instead of PATH_MAX.  Fixes compilation on GNU/Hurd.
+---
+ src/util.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/src/util.c b/src/util.c
+index 82a7e37..c4c0f9d 100644
+--- a/src/util.c
++++ b/src/util.c
+@@ -460,12 +460,12 @@ move_file (char const *from, bool *from_needs_removal,
+ 
+         /* FROM contains the contents of the symlink we have patched; need
+            to convert that back into a symlink. */
+-        char *buffer = xmalloc (PATH_MAX);
++        char *buffer = xmalloc (fromst->st_size + 1);
+         int fd, size = 0, i;
+ 
+         if ((fd = safe_open (from, O_RDONLY | O_BINARY, 0)) < 0)
+           pfatal ("Can't reopen file %s", quotearg (from));
+-        while ((i = read (fd, buffer + size, PATH_MAX - size)) > 0)
++        while ((i = read (fd, buffer + size, fromst->st_size - size)) > 0)
+           size += i;
+         if (i != 0 || close (fd) != 0)
+           read_fatal ();
+@@ -610,9 +610,9 @@ copy_file (char const *from, char const *to, struct stat 
*tost,
+ 
+   if (S_ISLNK (mode))
+     {
+-      char *buffer = xmalloc (PATH_MAX);
++      char *buffer = xmalloc (tost->st_size + 1);
+ 
+-      if (safe_readlink (from, buffer, PATH_MAX) < 0)
++      if (safe_readlink (from, buffer, tost->st_size) < 0)
+       pfatal ("Can't read %s %s", "symbolic link", from);
+       if (safe_symlink (buffer, to) != 0)
+       pfatal ("Can't create %s %s", "symbolic link", to);
+-- 
+2.4.2
+



reply via email to

[Prev in Thread] Current Thread [Next in Thread]