unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] gnu: patch: Set PATH_MAX for HURD systems.
@ 2015-06-08 13:23 Manolis Ragkousis
  2015-06-10 19:38 ` Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: Manolis Ragkousis @ 2015-06-08 13:23 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: Guix-devel

[-- Attachment #1: Type: text/plain, Size: 55 bytes --]

I think this one should also go to core-updates. WDYT?

[-- Attachment #2: 0001-gnu-patch-Set-PATH_MAX-for-HURD-systems.patch --]
[-- Type: text/x-patch, Size: 2473 bytes --]

From 075b0321ed609ee74f8c827081b2e9c9a19a9f4d Mon Sep 17 00:00:00 2001
From: Manolis Ragkousis <manolis837@gmail.com>
Date: Mon, 8 Jun 2015 16:19:58 +0300
Subject: [PATCH] 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 | 19 +++++++++++++++++++
 3 files changed, 22 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/patch-hurd-path-max.patch

diff --git a/gnu-system.am b/gnu-system.am
index 8b4f703..a3aea0a 100644
--- a/gnu-system.am
+++ b/gnu-system.am
@@ -507,6 +507,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 67bdab4..b074e71 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -164,7 +164,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..b77e19d
--- /dev/null
+++ b/gnu/packages/patches/patch-hurd-path-max.patch
@@ -0,0 +1,19 @@
+Define PATH_MAX for HURD systems.
+
+diff --git a/lib/pathmax.h b/lib/pathmax.h
+index bd0bc00..8835c98 100644
+--- a/lib/pathmax.h
++++ b/lib/pathmax.h
+@@ -45,6 +45,10 @@
+ 
+ # include <limits.h>
+ 
++# ifndef PATH_MAX
++#  define PATH_MAX 8192
++# endif
++
+ # ifndef _POSIX_PATH_MAX
+ #  define _POSIX_PATH_MAX 256
+ # endif
+-- 
+2.4.2
\ No newline at end of file
-- 
2.4.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] gnu: patch: Set PATH_MAX for HURD systems.
  2015-06-08 13:23 [PATCH] gnu: patch: Set PATH_MAX for HURD systems Manolis Ragkousis
@ 2015-06-10 19:38 ` Ludovic Courtès
  2015-06-11  9:35   ` Manolis Ragkousis
  0 siblings, 1 reply; 4+ messages in thread
From: Ludovic Courtès @ 2015-06-10 19:38 UTC (permalink / raw)
  To: Manolis Ragkousis; +Cc: Guix-devel

Manolis Ragkousis <manolis837@gmail.com> skribis:

> From 075b0321ed609ee74f8c827081b2e9c9a19a9f4d Mon Sep 17 00:00:00 2001
> From: Manolis Ragkousis <manolis837@gmail.com>
> Date: Mon, 8 Jun 2015 16:19:58 +0300
> Subject: [PATCH] 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.

Please use the patch from
<http://lists.gnu.org/archive/html/bug-patch/2015-06/msg00009.html>,
and be sure to mention that URL in the .patch file.

Also s/HURD/Hurd/ in the subject.  :-)

OK for core-updates with these changes!

Ludo’.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] gnu: patch: Set PATH_MAX for HURD systems.
  2015-06-10 19:38 ` Ludovic Courtès
@ 2015-06-11  9:35   ` Manolis Ragkousis
  2015-06-11 15:04     ` Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: Manolis Ragkousis @ 2015-06-11  9:35 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: Guix-devel

[-- Attachment #1: Type: text/plain, Size: 425 bytes --]

Hey Ludo,

On 10 June 2015 at 22:38, Ludovic Courtès <ludo@gnu.org> wrote:
> Please use the patch from
> <http://lists.gnu.org/archive/html/bug-patch/2015-06/msg00009.html>,
> and be sure to mention that URL in the .patch file.

Ok, but this patch is not enough. There is another occurrence of
PATH_MAX later in the same file.

The attached patch is an update of your patch.

Ok to use this version?

Manolis

[-- Attachment #2: 0001-Do-not-rely-on-PATH_MAX-when-reading-a-symlink-targe.patch --]
[-- Type: text/x-patch, Size: 1745 bytes --]

From 0507dfad5f060161f01840067e1bb1615257b636 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= <ludo@gnu.org>
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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] gnu: patch: Set PATH_MAX for HURD systems.
  2015-06-11  9:35   ` Manolis Ragkousis
@ 2015-06-11 15:04     ` Ludovic Courtès
  0 siblings, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2015-06-11 15:04 UTC (permalink / raw)
  To: Manolis Ragkousis; +Cc: Guix-devel

Manolis Ragkousis <manolis837@gmail.com> skribis:

> Hey Ludo,
>
> On 10 June 2015 at 22:38, Ludovic Courtès <ludo@gnu.org> wrote:
>> Please use the patch from
>> <http://lists.gnu.org/archive/html/bug-patch/2015-06/msg00009.html>,
>> and be sure to mention that URL in the .patch file.
>
> Ok, but this patch is not enough. There is another occurrence of
> PATH_MAX later in the same file.
>
> The attached patch is an update of your patch.
>
> Ok to use this version?

[...]

>    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)

LGTM; do send it to bug-patch as well.

Besides, I think this code misses:

  buffer[tost->st_size] = '\0';

once safe_readlink has succeeded.  I wonder why that even works
currently.

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-06-11 15:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-08 13:23 [PATCH] gnu: patch: Set PATH_MAX for HURD systems Manolis Ragkousis
2015-06-10 19:38 ` Ludovic Courtès
2015-06-11  9:35   ` Manolis Ragkousis
2015-06-11 15:04     ` Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).