From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id CAfpOVj6ImR3XQAASxT56A (envelope-from ) for ; Tue, 28 Mar 2023 16:31:53 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id GAXhOFj6ImSHzAAAG6o9tA (envelope-from ) for ; Tue, 28 Mar 2023 16:31:52 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 9B29D3990 for ; Tue, 28 Mar 2023 16:31:52 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b="kjOjl/6P"; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1680013912; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=/Rgw1gb5kV/HrPlNxWk92GVwQu3UCUrQSiYWxcTuj4c=; b=G6hozfYAv7By8cErIDKdxd9g1JFDH0oUR2MdOSO0aajtZWB396/pNRt3zgFikn7DE0uqG0 CbyWrpYo8JQNV3IWjFbp7UhGIq0za1WS0DYmRWLP7oubz1BfBotsILTqbdo8NOEDS75175 Droy7t1cirytpZTvfvGipILUrC6X/0Ca1n9cP5bMxmkRBFFgyOmmjDK2dloKoM+BOr3waE xQfCxo+6EwfT2WjKlrNvTZ9bQm1/vvq/zxwfq3QRF+w3EvzCvdcFBWTXVZRSHt29SKPMRB V69tsF/Z6kjCRAAD4XS5OIiueGfQSDKr9dYYg6VplHnHTbQfB/gGbXnla5W6zQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1680013912; a=rsa-sha256; cv=none; b=N72PPWbfI02Wg4AbTcJJGlTdXSl+nlbV5TZEhQxdAsA0bLpeiiwB5C5WNEurpTwHPuNLkO VVLYu/eLP3+8UdVUICGXxEFWoAjQToScmcJPuM2Qs3ZgQf0w9HuVUpBByFWfOvYobVsI1e wf35ypwJ19lDM5/E8rENR6ljUqaVuNtKXzOiXo1M1wDSG+OlQwVyMYdZMr37v+RYQcmUdE doT7cOyZmtZsDIN9c9ZKJwfzENfCqSFMMDbbNF8SXFUOMg0TO+W3CTwcXTos8Ts/8USY9d GOOCaRVFu7ZMxy89Fd4a5rCiX5Bd/W+xYPxzQztfNGaSpc7V08xvAS9OySuUPg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b="kjOjl/6P"; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1phAL6-0004o6-Dx; Tue, 28 Mar 2023 10:30:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1phAKz-0004je-GR for guix-patches@gnu.org; Tue, 28 Mar 2023 10:30:14 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1phAKz-0006u9-6C for guix-patches@gnu.org; Tue, 28 Mar 2023 10:30:13 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1phAKy-0002cg-S7 for guix-patches@gnu.org; Tue, 28 Mar 2023 10:30:13 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#62307] [PATCH core-updates v2 20/20] gnu: guile: Fix 'posix_spawn' usage for GNU/Hurd. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 28 Mar 2023 14:30:12 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62307 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 62307@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= Received: via spool by 62307-submit@debbugs.gnu.org id=B62307.16800137899880 (code B ref 62307); Tue, 28 Mar 2023 14:30:12 +0000 Received: (at 62307) by debbugs.gnu.org; 28 Mar 2023 14:29:49 +0000 Received: from localhost ([127.0.0.1]:50442 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1phAKb-0002ZD-9x for submit@debbugs.gnu.org; Tue, 28 Mar 2023 10:29:49 -0400 Received: from eggs.gnu.org ([209.51.188.92]:47300) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1phAKJ-0002WE-GW for 62307@debbugs.gnu.org; Tue, 28 Mar 2023 10:29:31 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1phAKE-0006Tt-9r; Tue, 28 Mar 2023 10:29:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=/Rgw1gb5kV/HrPlNxWk92GVwQu3UCUrQSiYWxcTuj4c=; b=kjOjl/6Ppx2xNXu0H8rz Mx8WEk6pWyPiI1n1Lncz0udCcQQlF23LP2C0W1VoqJduudc5fc+P5JJC/pkfe5/IaivLE8hUoDlUt lCJ81dxASyotbBSKFIgcYmnRU0URTyClkg65Jn3ynAc5Cxy93DfLWjh5yuUS1/cUkdlNJE+on2MI9 RzbxmKPJkkUG0YV28m3YiCKidgEFyKws6HTNb02bLi9tWLewtfMerUaKKUqgeL3kc45tAJ9Xqa8Mv oHzU1WxoOrsvVnIsJTVSEuqOjsC1tq3KM3EYI7CxvIAw+s1JywDOlGL+7/LO+3YF4cfi6BZTZoiS2 AaskI0vW9bp+XQ==; Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1phAKD-00026Y-Ss; Tue, 28 Mar 2023 10:29:26 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Tue, 28 Mar 2023 16:28:52 +0200 Message-Id: <20230328142852.26635-21-ludo@gnu.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230328142852.26635-1-ludo@gnu.org> References: <87pm90bzva.fsf_-_@gnu.org> <20230328142852.26635-1-ludo@gnu.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: X-Migadu-Queue-Id: 9B29D3990 X-Spam-Score: -2.03 X-Migadu-Spam-Score: -2.03 X-Migadu-Scanner: scn0.migadu.com List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-TUID: q3xpjFob0La8 * gnu/packages/guile.scm (guile-3.0)[arguments]: Add 'patch-posix-spawn-usage' phase. * gnu/packages/patches/guile-hurd-posix-spawn.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. --- gnu/local.mk | 1 + gnu/packages/guile.scm | 10 +++++ .../patches/guile-hurd-posix-spawn.patch | 44 +++++++++++++++++++ 3 files changed, 55 insertions(+) create mode 100644 gnu/packages/patches/guile-hurd-posix-spawn.patch diff --git a/gnu/local.mk b/gnu/local.mk index b0483b4692..fdc307f540 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1293,6 +1293,7 @@ dist_patch_DATA = \ %D%/packages/patches/guile-fibers-wait-for-io-readiness.patch \ %D%/packages/patches/guile-gdbm-ffi-support-gdbm-1.14.patch \ %D%/packages/patches/guile-git-adjust-for-libgit2-1.2.0.patch \ + %D%/packages/patches/guile-hurd-posix-spawn.patch \ %D%/packages/patches/guile-present-coding.patch \ %D%/packages/patches/guile-rsvg-pkgconfig.patch \ %D%/packages/patches/guile-emacs-fix-configure.patch \ diff --git a/gnu/packages/guile.scm b/gnu/packages/guile.scm index 8e52448d36..8d25614e3a 100644 --- a/gnu/packages/guile.scm +++ b/gnu/packages/guile.scm @@ -371,6 +371,16 @@ (define-public guile-3.0 (("!#") "!#\n(exit 77)\n")))) + #$@(if (target-hurd?) + #~((add-before 'build 'patch-posix-spawn-usage + (lambda _ + ;; TODO: Move patch to 'source' on next rebuild + ;; cycle. + (define patch + #$(local-file + (search-patch "guile-hurd-posix-spawn.patch"))) + (invoke "patch" "--force" "-p1" "-i" patch)))) + #~()) #$@(if (target-ppc32?) #~((add-after 'unpack 'adjust-bootstrap-flags (lambda _ diff --git a/gnu/packages/patches/guile-hurd-posix-spawn.patch b/gnu/packages/patches/guile-hurd-posix-spawn.patch new file mode 100644 index 0000000000..7cf600b4c2 --- /dev/null +++ b/gnu/packages/patches/guile-hurd-posix-spawn.patch @@ -0,0 +1,44 @@ +Fix , which affects GNU/Hurd. + +diff --git a/libguile/posix.c b/libguile/posix.c +index 3a8be94e4..f5fdc544c 100644 +--- a/libguile/posix.c ++++ b/libguile/posix.c +@@ -1326,7 +1326,14 @@ static void + close_inherited_fds_slow (posix_spawn_file_actions_t *actions, int max_fd) + { + while (--max_fd > 2) +- posix_spawn_file_actions_addclose (actions, max_fd); ++ { ++ /* Adding invalid file descriptors to an 'addclose' action leads ++ to 'posix_spawn' failures on some operating systems: ++ . Hence the extra check. */ ++ int flags = fcntl (max_fd, F_GETFD, NULL); ++ if ((flags >= 0) && ((flags & FD_CLOEXEC) == 0)) ++ posix_spawn_file_actions_addclose (actions, max_fd); ++ } + } + + static void + +Fix . + +diff --git a/test-suite/tests/posix.test b/test-suite/tests/posix.test +index f20e04453..d5cf47cda 100644 +--- a/test-suite/tests/posix.test ++++ b/test-suite/tests/posix.test +@@ -431,7 +431,13 @@ + (let ((str (get-string-all (car input+output)))) + (close-port (car input+output)) + (waitpid pid) +- str))) ++ ++ ;; On GNU/Hurd, the exec server prepends 'LD_ORIGIN_PATH' for ++ ;; every program: . Strip it. ++ (if (and (string=? "GNU" (utsname:sysname (uname))) ++ (string-prefix? "LD_ORIGIN_PATH=" str)) ++ (string-drop str (+ 1 (string-index str #\newline))) ++ str)))) + + (pass-if-equal "ls /proc/self/fd" + "0\n1\n2\n3\n" ;fourth FD is for /proc/self/fd -- 2.39.2