all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Janneke Nieuwenhuizen <janneke@gnu.org>
To: 64711@debbugs.gnu.org
Subject: [bug#64711] [PATCH 38/43] gnu: ghostscript: Fix build for the Hurd.
Date: Tue, 18 Jul 2023 16:40:31 +0200	[thread overview]
Message-ID: <d56ec2c9eaff6620d299c23d86e4b351129146b0.1689690897.git.janneke@gnu.org> (raw)
In-Reply-To: <cover.1689690897.git.janneke@gnu.org>

* gnu/packages/patches/ghostscript-leptonica-hurd.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/ghostscript.scm (ghostscript)[arguments]: When building for the
Hurd, add phase 'patch-leptonica' and use it.
---
 gnu/local.mk                                  |  3 +-
 gnu/packages/ghostscript.scm                  | 10 +++
 .../patches/ghostscript-leptonica-hurd.patch  | 78 +++++++++++++++++++
 3 files changed, 89 insertions(+), 2 deletions(-)
 create mode 100644 gnu/packages/patches/ghostscript-leptonica-hurd.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 84c4167723..45b1c1356b 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1238,8 +1238,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/ghc-bloomfilter-ghc9.2.patch	\
   %D%/packages/patches/ghc-bytestring-handle-ghc9.patch	\
   %D%/packages/patches/ghc-language-haskell-extract-ghc-8.10.patch	\
-  %D%/packages/patches/ghostscript-CVE-2023-36664.patch		\
-  %D%/packages/patches/ghostscript-CVE-2023-36664-fixup.patch	\
+  %D%/packages/patches/ghostscript-leptonica-hurd.patch		\
   %D%/packages/patches/ghostscript-no-header-id.patch		\
   %D%/packages/patches/ghostscript-no-header-uuid.patch		\
   %D%/packages/patches/ghostscript-no-header-creationdate.patch \
diff --git a/gnu/packages/ghostscript.scm b/gnu/packages/ghostscript.scm
index 94807fdd94..2d7f07fb40 100644
--- a/gnu/packages/ghostscript.scm
+++ b/gnu/packages/ghostscript.scm
@@ -201,6 +201,16 @@ (define-public ghostscript
                      '()))
       #:phases
       #~(modify-phases %standard-phases
+          #$@(if (target-hurd?)
+                 #~((add-after 'unpack 'patch-leptonica
+                      (lambda _
+                        (let ((patch-file
+                               #$(local-file
+                                  (search-patch
+                                   "ghostscript-leptonica-hurd.patch"))))
+                          (with-directory-excursion "leptonica"
+                            (invoke "patch" "--force" "-p1" "-i" patch-file))))))
+                 #~())
           (add-before 'configure 'create-output-directory
             (lambda _
               ;; The configure script refuses to function if the directory
diff --git a/gnu/packages/patches/ghostscript-leptonica-hurd.patch b/gnu/packages/patches/ghostscript-leptonica-hurd.patch
new file mode 100644
index 0000000000..124365b3e6
--- /dev/null
+++ b/gnu/packages/patches/ghostscript-leptonica-hurd.patch
@@ -0,0 +1,78 @@
+Upstream status: This patch was taken from leptonica upstream.
+
+Backported to ghostscripts bundled leptonica.
+
+From f04da7c816feb1d5f689c34f3d0e7e3621edf1f5 Mon Sep 17 00:00:00 2001
+From: Samuel Thibault <samuel.thibault@ens-lyon.org>
+Date: Wed, 1 Feb 2023 19:35:43 +0100
+Subject: [PATCH] Fix GNU/Hurd build
+
+There is no PATH_MAX limitation on GNU/Hurd, and realpath() can be
+safely be used with its second parameter set to NULL (as required by
+posix since its version 2001).
+---
+ src/sarray1.c | 29 +++++++++++++++++++++++------
+ 1 file changed, 23 insertions(+), 6 deletions(-)
+
+--- a/src/sarray1.c	2023-06-13 12:31:13.393672916 +0200
++++ a/src/sarray1.c	2023-06-13 12:34:13.574237149 +0200
+@@ -1953,7 +1953,11 @@
+ SARRAY *
+ getFilenamesInDirectory(const char  *dirname)
+ {
++#if _POSIX_VERSION >= 200112 || defined(__GLIBC__)
++char           *dir;
++#else
+ char            dir[PATH_MAX + 1];
++#endif
+ char           *realdir, *stat_path, *ignore;
+ size_t          size;
+ SARRAY         *safiles;
+@@ -1976,17 +1980,28 @@
+             * If the file or directory exists, realpath returns its path;
+               else it returns NULL.
+             * If the second arg to realpath is passed in, the canonical path
+-              is returned there.  Use a buffer of sufficient size.  If the
+-              second arg is NULL, the path is malloc'd and returned if the
+-              file or directory exists.
+-           We pass in a buffer for the second arg, and check that the canonical
+-           directory path was made.  The existence of the directory is checked
+-           later, after its actual path is returned by genPathname().  */
++              is returned there.  Use a buffer of sufficient size.
++              We pass in a buffer for the second arg, and check that the
++              canonical directory path was made.  The existence of the
++              directory is checked later, after its actual path is returned by
++              genPathname().
++              With GNU libc or Posix 2001, if the second arg is NULL, the path
++              is malloc'd and returned if the file or directory exists.
++           */
++#if _POSIX_VERSION >= 200112 || defined(__GLIBC__)
++    dir = realpath(dirname, NULL);
++    if (dir == NULL)
++        return (SARRAY *)ERROR_PTR("dir not made", __func__, NULL);
++#else
+     dir[0] = '\0';  /* init empty in case realpath() fails to write it */
+     ignore = realpath(dirname, dir);
+     if (dir[0] == '\0')
+         return (SARRAY *)ERROR_PTR("dir not made", procName, NULL);
++#endif
+     realdir = genPathname(dir, NULL);
++#if _POSIX_VERSION >= 200112 || defined(__GLIBC__)
++    LEPT_FREE(dir);
++#endif
+     if ((pdir = opendir(realdir)) == NULL) {
+         LEPT_FREE(realdir);
+         return (SARRAY *)ERROR_PTR("pdir not opened", procName, NULL);
+@@ -1998,10 +2013,12 @@
+         stat_ret = fstatat(dfd, pdirentry->d_name, &st, 0);
+ #else
+         size = strlen(realdir) + strlen(pdirentry->d_name) + 2;
++#if _POSIX_VERSION < 200112 && !defined(__GLIBC__)
+         if (size > PATH_MAX) {
+             L_ERROR("size = %zu too large; skipping\n", procName, size);
+             continue;
+         }
++#endif
+         stat_path = (char *)LEPT_CALLOC(size, 1);
+         snprintf(stat_path, size, "%s/%s", realdir, pdirentry->d_name);
+         stat_ret = stat(stat_path, &st);
-- 
2.40.1





  parent reply	other threads:[~2023-07-18 14:44 UTC|newest]

Thread overview: 78+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-18 14:38 [bug#64711] [PATCH 00/45] Fix builds and skip failing tests for the Hurd Janneke Nieuwenhuizen
2023-07-18 14:39 ` [bug#64711] [PATCH 01/43] Revert "gnu: libunistring: Fix make check for the Hurd." Janneke Nieuwenhuizen
2023-07-18 14:39 ` [bug#64711] [PATCH 02/43] gnu: guile: Skip hanging and failing pipe tests on the Hurd Janneke Nieuwenhuizen
2023-07-18 20:18   ` [bug#64711] [PATCH 00/45] Fix builds and skip failing tests for " Ludovic Courtès
2023-07-19  5:23     ` Janneke Nieuwenhuizen
2023-07-19  6:27     ` Janneke Nieuwenhuizen
2023-07-18 14:39 ` [bug#64711] [PATCH 03/43] gnu: coreutils: Skip hanging and failing test on " Janneke Nieuwenhuizen
2023-07-18 20:13   ` [bug#64711] [PATCH 00/45] Fix builds and skip failing tests for " Ludovic Courtès
2023-07-18 20:23     ` Janneke Nieuwenhuizen
2023-07-18 20:23     ` Janneke Nieuwenhuizen
2023-07-18 14:39 ` [bug#64711] [PATCH 04/43] gnu: grep: Update hanging and failing tests on " Janneke Nieuwenhuizen
2023-07-18 20:23   ` [bug#64711] [PATCH 00/45] Fix builds and skip failing tests for " Ludovic Courtès
2023-07-18 14:39 ` [bug#64711] [PATCH 05/43] Revert "gnu: sed: Skip failing test on GNU/Hurd." Janneke Nieuwenhuizen
2023-07-18 14:39 ` [bug#64711] [PATCH 06/43] gnu: findutils: Move test-strerror_r from XFAIL to skip on the Hurd Janneke Nieuwenhuizen
2023-07-18 14:40 ` [bug#64711] [PATCH 07/43] gnu: diffutils: Remove test-perror2 from XFAIL_TESTS " Janneke Nieuwenhuizen
2023-07-18 14:40 ` [bug#64711] [PATCH 08/43] gnu: gettext-minimal: Remove XFAIL_TESTS for " Janneke Nieuwenhuizen
2023-07-18 14:40 ` [bug#64711] [PATCH 09/43] gnu: m4: Skip gnulib stack-overflow tests " Janneke Nieuwenhuizen
2023-07-18 14:40 ` [bug#64711] [PATCH 10/43] gnu: openssl: Build fix " Janneke Nieuwenhuizen
2023-07-18 17:53   ` [bug#64711] [PATCH 00/45] Fix builds and skip failing tests " Ludovic Courtès
2023-07-18 18:04     ` Janneke Nieuwenhuizen
2023-07-18 14:40 ` [bug#64711] [PATCH 11/43] gnu: python: Support native build on " Janneke Nieuwenhuizen
2023-07-18 14:40 ` [bug#64711] [PATCH 12/43] gnu: mpfr: Skip failing test " Janneke Nieuwenhuizen
2023-07-18 17:57   ` [bug#64711] [PATCH 00/45] Fix builds and skip failing tests for " Ludovic Courtès
2023-07-18 14:40 ` [bug#64711] [PATCH 13/43] gnu: elfutils: Skip failing tests on " Janneke Nieuwenhuizen
2023-07-18 14:40 ` [bug#64711] [PATCH 14/43] gnu: libbsd: Skip failing test " Janneke Nieuwenhuizen
2023-07-18 14:40 ` [bug#64711] [PATCH 15/43] gnu: c-ares: Skip failing tests " Janneke Nieuwenhuizen
2023-07-18 14:40 ` [bug#64711] [PATCH 16/43] gnu: libgpg-error: Skip failing test " Janneke Nieuwenhuizen
2023-07-18 14:40 ` [bug#64711] [PATCH 17/43] gnu: libgcrypt: Skip hanging benchmark tests " Janneke Nieuwenhuizen
2023-07-18 14:40 ` [bug#64711] [PATCH 18/43] gnu: tcl: Remove failing " Janneke Nieuwenhuizen
2023-07-18 14:40 ` [bug#64711] [PATCH 19/43] gnu: curl: Skip failing test " Janneke Nieuwenhuizen
2023-07-18 14:40 ` [bug#64711] [PATCH 20/43] gnu: git: " Janneke Nieuwenhuizen
2023-07-18 14:40 ` [bug#64711] [PATCH 21/43] gnu: emacs: Depend on libc-for-target Janneke Nieuwenhuizen
2023-07-18 15:54   ` Liliana Marie Prikler
2023-07-18 16:39     ` Janneke Nieuwenhuizen
2023-07-18 14:40 ` [bug#64711] [PATCH 22/43] gnu: procps: Skip linux-version test for the Hurd Janneke Nieuwenhuizen
2023-07-18 14:40 ` [bug#64711] [PATCH 23/43] gnu: e2fsprogs: Skip failing tests on " Janneke Nieuwenhuizen
2023-07-18 14:40 ` [bug#64711] [PATCH 24/43] gnu: parted: Disable tests for " Janneke Nieuwenhuizen
2023-07-18 14:40 ` [bug#64711] [PATCH 25/43] gnu: libpaper: " Janneke Nieuwenhuizen
2023-07-18 14:40 ` [bug#64711] [PATCH 26/43] gnu: cairo: Support building " Janneke Nieuwenhuizen
2023-07-18 15:57   ` Liliana Marie Prikler
2023-07-18 16:33     ` Janneke Nieuwenhuizen
2023-07-18 20:06       ` Maxim Cournoyer
2023-07-19  9:30         ` Janneke Nieuwenhuizen
2023-07-20  3:14           ` Maxim Cournoyer
2023-07-21 18:27             ` Janneke Nieuwenhuizen
2023-07-18 14:40 ` [bug#64711] [PATCH 27/43] gnu: openssl-1.1: Fix shared build " Janneke Nieuwenhuizen
2023-07-18 14:40 ` [bug#64711] [PATCH 28/43] gnu: ruby-2.6: Skip test on " Janneke Nieuwenhuizen
2023-07-18 14:40 ` [bug#64711] [PATCH 29/43] gnu: tcsh: Skip substitution tests " Janneke Nieuwenhuizen
2023-07-18 14:40 ` [bug#64711] [PATCH 30/43] gnu: swig: Skip tests when building for " Janneke Nieuwenhuizen
2023-07-18 14:40 ` [bug#64711] [PATCH 31/43] gnu: zstd: " Janneke Nieuwenhuizen
2023-07-18 14:40 ` [bug#64711] [PATCH 32/43] gnu: cmake-bootstrap: Fix build " Janneke Nieuwenhuizen
2023-07-18 14:40 ` [bug#64711] [PATCH 33/43] gnu: cmake-minimal: Skip tests on " Janneke Nieuwenhuizen
2023-07-18 14:40 ` [bug#64711] [PATCH 34/43] gnu: doxygen: Fix build for " Janneke Nieuwenhuizen
2023-07-18 14:40 ` [bug#64711] [PATCH 35/43] gnu: graphite2: Skip test on " Janneke Nieuwenhuizen
2023-07-18 14:40 ` [bug#64711] [PATCH 36/43] gnu: guile-git: Skip http proxy " Janneke Nieuwenhuizen
2023-07-18 14:40 ` [bug#64711] [PATCH 37/43] gnu: glib: Disable tests for " Janneke Nieuwenhuizen
2023-07-18 15:56   ` Liliana Marie Prikler
2023-07-18 16:32     ` Janneke Nieuwenhuizen
2023-07-18 20:05       ` Maxim Cournoyer
2023-07-20  8:19         ` Janneke Nieuwenhuizen
2023-07-20 18:08           ` Maxim Cournoyer
2023-07-21 17:22             ` Janneke Nieuwenhuizen
2023-07-18 14:40 ` Janneke Nieuwenhuizen [this message]
2023-07-18 14:40 ` [bug#64711] [PATCH 39/43] gnu: harfbuzz: Support build " Janneke Nieuwenhuizen
2023-07-18 20:13   ` Maxim Cournoyer
2023-07-18 14:40 ` [bug#64711] [PATCH 40/43] gnu: pango: " Janneke Nieuwenhuizen
2023-07-18 20:04   ` Maxim Cournoyer
2023-07-18 20:15     ` Janneke Nieuwenhuizen
2023-07-19  0:56       ` Maxim Cournoyer
2023-07-19  6:14         ` Janneke Nieuwenhuizen
2023-07-19 16:22           ` Maxim Cournoyer
2023-07-19 20:51             ` Janneke Nieuwenhuizen
2023-07-18 14:40 ` [bug#64711] [PATCH 41/43] gnu: fontforge: Support build on " Janneke Nieuwenhuizen
2023-07-18 14:40 ` [bug#64711] [PATCH 42/43] gnu: po4a: Skip failing test " Janneke Nieuwenhuizen
2023-07-18 14:40 ` [bug#64711] [PATCH 43/43] gnu: guile-2.0: Skip failing tests " Janneke Nieuwenhuizen
2023-07-18 14:48 ` [bug#64711] [PATCH 00/43] Fix builds and skip failing tests for " Janneke Nieuwenhuizen
2023-07-18 20:29 ` [bug#64711] [PATCH 00/45] " Ludovic Courtès
2023-07-20  8:27   ` bug#64711: " Janneke Nieuwenhuizen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d56ec2c9eaff6620d299c23d86e4b351129146b0.1689690897.git.janneke@gnu.org \
    --to=janneke@gnu.org \
    --cc=64711@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.