From 4ab17ac72e483a230a45f1745cc95c2a80a554dd Mon Sep 17 00:00:00 2001 From: Yelninei Date: Thu, 31 Jul 2025 10:11:20 +0000 Subject: [PATCH] gnu: libxcb: Add a patch for PATH_MAX on the Hurd. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Followup to 214b9d500f1434f745c26c5d9f826615d754a3ce. The PATH_MAX issue has been solved upstream so use their patch instead. * gnu/packages/patches/libxcb-path-max.patch: New patch. * gnu/local.mk (dist_path_DATA): Add it. * gnu/packages/xorg.scm (libxcb): Adjust ‘fix-PATH_MAX’ phase to apply the patch instead of substituting the source. Change-Id: I290033978a86aaa9e87149b6bed9aec0918076f3 Signed-off-by: Ludovic Courtès --- gnu/local.mk | 1 + gnu/packages/patches/libxcb-path-max.patch | 37 ++++++++++++++++++++++ gnu/packages/xorg.scm | 5 +-- 3 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 gnu/packages/patches/libxcb-path-max.patch diff --git a/gnu/local.mk b/gnu/local.mk index 2310b87a840aacba80ad2f78db4202d3f67b7849..1c520549eb17e93fc8b4affcceea805f2fd51ec2 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1797,6 +1797,7 @@ dist_patch_DATA = \ %D%/packages/patches/libutils-remove-damaging-includes.patch \ %D%/packages/patches/libvdpau-va-gl-unbundle.patch \ %D%/packages/patches/libvpx-CVE-2016-2818.patch \ + %D%/packages/patches/libxcb-path-max.patch \ %D%/packages/patches/libxml2-xpath0-Add-option-xpath0.patch \ %D%/packages/patches/libwpd-gcc-compat.patch \ %D%/packages/patches/libxslt-generated-ids.patch \ diff --git a/gnu/packages/patches/libxcb-path-max.patch b/gnu/packages/patches/libxcb-path-max.patch new file mode 100644 index 0000000000000000000000000000000000000000..64a870569f32de6839a4bba9077a8537516d19fc --- /dev/null +++ b/gnu/packages/patches/libxcb-path-max.patch @@ -0,0 +1,37 @@ +Taken from: +https://gitlab.freedesktop.org/xorg/lib/libxcb/-/commit/6a7661f60a70ff42c64b32a725edcbee790d1c0d + +From 6a7661f60a70ff42c64b32a725edcbee790d1c0d Mon Sep 17 00:00:00 2001 +From: Samuel Thibault +Date: Tue, 8 Jul 2025 13:29:00 +0200 +Subject: [PATCH] Get rid of PATH_MAX + +There could be no upper limit on the length of a path according +to POSIX, therefore these macros may not be defined at all on +some systems (such as GNU Hurd). There is however a limit on +sizeof(struct sockaddr_un.sun_path), so use it. + +Signed-off-by: Samuel Thibault +Part-of: +--- + src/xcb_util.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/src/xcb_util.c b/src/xcb_util.c +index 5124d14..017583e 100644 +--- a/src/xcb_util.c ++++ b/src/xcb_util.c +@@ -104,7 +104,9 @@ static int _xcb_parse_display_path_to_socket(const char *name, char **host, char + int *displayp, int *screenp) + { + struct stat sbuf; +- char path[PATH_MAX]; ++ /* In addition to the AF_UNIX path, there may be a screen number. ++ * The trailing \0 is already accounted in the size of sun_path. */ ++ char path[sizeof(((struct sockaddr_un*)0)->sun_path) + 1 + 10]; + size_t len; + int _screen = 0, res; + +-- +GitLab + diff --git a/gnu/packages/xorg.scm b/gnu/packages/xorg.scm index 7b667da0b3062e9b6a64e0af42f6a98e82e7ba73..bee44f58588dc123221ffbee44fcf19f77cdff94 100644 --- a/gnu/packages/xorg.scm +++ b/gnu/packages/xorg.scm @@ -5201,8 +5201,9 @@ protocol.") (add-after 'unpack 'fix-PATH_MAX (lambda _ ;; Hurd doesn't define PATH_MAX. - (substitute* "src/xcb_util.c" - (("PATH_MAX") "4096"))))) + (let ((patch #$(local-file + (search-patch "libxcb-path-max.patch")))) + (invoke "patch" "--force" "-p1" "-i" patch))))) #~%standard-phases))) (home-page "https://xcb.freedesktop.org/") (synopsis "The X C Binding (XCB) library")