From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id aFgSLR+p8GJS7gAAbAwnHQ (envelope-from ) for ; Mon, 08 Aug 2022 08:11:43 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id WEDRLB+p8GKSgwAAauVa8A (envelope-from ) for ; Mon, 08 Aug 2022 08:11:43 +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 668B720981 for ; Mon, 8 Aug 2022 08:11:43 +0200 (CEST) Received: from localhost ([::1]:52374 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oKvzK-0003ox-Da for larch@yhetil.org; Mon, 08 Aug 2022 02:11:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58506) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oKvyh-0003jf-NA for guix-patches@gnu.org; Mon, 08 Aug 2022 02:11:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:49199) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oKvyh-0002nj-6d for guix-patches@gnu.org; Mon, 08 Aug 2022 02:11:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oKvyh-0002u5-2J for guix-patches@gnu.org; Mon, 08 Aug 2022 02:11:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#57050] [PATCH 3/6] gnu: chez-scheme: Fix use of "/bin/sh". Resent-From: Philip McGrath Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 08 Aug 2022 06:11:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57050 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 57050@debbugs.gnu.org Cc: Philip McGrath Received: via spool by 57050-submit@debbugs.gnu.org id=B57050.165993903711073 (code B ref 57050); Mon, 08 Aug 2022 06:11:03 +0000 Received: (at 57050) by debbugs.gnu.org; 8 Aug 2022 06:10:37 +0000 Received: from localhost ([127.0.0.1]:38935 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oKvyG-0002sV-Jk for submit@debbugs.gnu.org; Mon, 08 Aug 2022 02:10:37 -0400 Received: from mail-qt1-f170.google.com ([209.85.160.170]:38412) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oKvyE-0002s5-9a for 57050@debbugs.gnu.org; Mon, 08 Aug 2022 02:10:35 -0400 Received: by mail-qt1-f170.google.com with SMTP id z3so5825691qtv.5 for <57050@debbugs.gnu.org>; Sun, 07 Aug 2022 23:10:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=philipmcgrath.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=DtZfqtIsJ2MblxYqADhd/qvG/+8w4KiA6L+Lj97pd8A=; b=CcdhslzqYH9EYkHy/xOABk6yPsV1PjtPjv9X43fe7G3zUAz82WZgvuhQswgqSKW5n2 MfdwE5kXrmpFJjwJHXkl8LAFAas6c5yEvEVp1MAFuyn1+KooJIS02KY4EmKbZG/Vs1sb 8iAp7AVYyDsxBeGO5yy0PA6BBmVRK/ihwfIoJAUUDB8uNlNAwB+SKHlB1HJm7bcm4eE5 RqOXN07g77QCmPKX00ziw1zxO1WiEwKZmKv6FH/iScvKFY1UWgP1OyD7Gp8HUc2/27Ks 45gqroazeEPbcL3BEy9qdebJjbxRTmUk6RYGAKLKgeCz2TwG99CImiQPEWIB37DgHAMu wAUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=DtZfqtIsJ2MblxYqADhd/qvG/+8w4KiA6L+Lj97pd8A=; b=Ccik/S5M7u2ISfRsz9sn4pKQGzhavimtvkYQbp2hvY+lJcV86dIMuLuGxSFRN0JU3e XZR+1IpUKGZmUq8meTPh4Z/PPXILt3v5IMuEg9OafRjNMM8LCIQ+es45qZ2pqp7+nc4y 193OBscAT2lWKpHLcHUkI06vMLyh2B+bQza/csBiG4V+opoCURiMX9d3AcJzufxALoH9 bWKdhVWfvj/l67+uO6s7WtNSOvKro+8wmqSxwsrGNYhzvk8FtiR3prYboKbvvora0MF1 aElfEqF63eQ5rNyfL6qyaNGyKV+qZiDBcbR3SSlGNI7q3mQFawf/mGy0HvG441MqSv7R Z2HQ== X-Gm-Message-State: ACgBeo1ICfHwlmPFVB8Jq9e105LmXaajo4z4xk1ISrcIlTB88WWYYdlf 0NHxajzoesT2MYq0oPqMKqhKYoNWOSTM7/ch X-Google-Smtp-Source: AA6agR6IJDxRhkqCVhwhHv3aDbbJHmXlsfR4DemyV/JlyCEAcd454HBryiVIiApMNLqNTugPER6tew== X-Received: by 2002:ac8:7318:0:b0:342:f5bf:2093 with SMTP id x24-20020ac87318000000b00342f5bf2093mr5012607qto.235.1659939028128; Sun, 07 Aug 2022 23:10:28 -0700 (PDT) Received: from localhost (c-73-125-98-51.hsd1.fl.comcast.net. [73.125.98.51]) by smtp.gmail.com with UTF8SMTPSA id u17-20020a05622a011100b003051ea4e7f6sm7642771qtw.48.2022.08.07.23.10.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 07 Aug 2022 23:10:27 -0700 (PDT) From: Philip McGrath Date: Mon, 8 Aug 2022 02:10:04 -0400 Message-Id: <5e5e8f491c7cbee3ef7a21437a52675dd47d186e.1659936550.git.philip@philipmcgrath.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: References: 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: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1659939103; 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=DtZfqtIsJ2MblxYqADhd/qvG/+8w4KiA6L+Lj97pd8A=; b=ra1txfeveSa3ziYJN/i97OgiqFxOzWQhCHLf1VXV3DoCjNoIps3/+QstIseuHg1jytJhOq hrrUyHoW+TlPA0t2RLTkTbAHFQBp/mj7/QMYgtLh4dctZaqvKt7NvKqxu+RG2QWaMT8wrg oR/p45vVvv0FLxrF9heTXxYlRKhk9gj50wDWMHoWc0YQlvfB87k6a6/Zp3LX8dC1DCgKYK WwNCUHExmpBdx2mMviG7INZN5D32mgdRNHofXKUfInLJ/P1Hs/jGcRDoSZNV8IgxhL1KDj QYVwxOCGHwGx1QoPYuFfSjTrTtk5dBK6rKj3KXQ0/+MefLOhFxWkxC8pEw2yEg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1659939103; a=rsa-sha256; cv=none; b=M5J2llUo3yjL+nYPwSnMHe+yJdSYWLLCXY0I450j5F/QACleUxlnihbWovvsZ2Vl9d1kk4 L/vS4o8RxQMuKLeELxuuIJMPrVxvz1lC9AsdAsoqylBaWamfOr8HMsos67fY/+FJPB485l NPUpmDeXmwDo/yA5C4BcRnymEXKYDffO1JxKvz5tKAe1D9jSfItqkouqJQQpBMUWWCNkBg CohP1gvqX36hrTW+pFU/4VEu9p5kUe5E6bMRW3DWTdjaXMy7yowyOqkh1U8DpSyj5hd/nd tS7cjGoD6mKfer5NyfDZuRP9ZypXrAVPGh8gZ9CHOUjyncgnwSnkTPvuH1nrEQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=philipmcgrath.com header.s=google header.b=Ccdhslzq; dmarc=none; 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" X-Migadu-Spam-Score: 1.81 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=philipmcgrath.com header.s=google header.b=Ccdhslzq; dmarc=none; 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" X-Migadu-Queue-Id: 668B720981 X-Spam-Score: 1.81 X-Migadu-Scanner: scn0.migadu.com X-TUID: +KLHHxMHQ/9B The unsuccessful attempt to execute "/bin/sh" by Chez Scheme's 'process' function seems to have caused parts of the Chez Scheme test suite to have been silently skipped. The issue was exposed by the upcoming changes to Racket's build system. * gnu/packages/patches/chez-scheme-bin-sh.patch, gnu/packages/patches/racket-chez-scheme-bin-sh.patch: New patches. * gnu/packages/patches/racket-minimal-sh-via-rktio.patch: Rename to ... * gnu/packages/patches/racket-rktio-bin-sh.patch: ... this, refresh with upstream, and shorten the macro name. * gnu/local.mk (dist_patch_DATA): Update accordingly. * gnu/packages/racket.scm (%racket-origin)[patches]: Likewise. (racket-vm-common-configure-flags): Likewise. * gnu/packages/chez.scm (chez-scheme)[origin]: Likewise. [inputs]: Add bash-minimal. [arguments]<#:configure-flags>: Set CPPFLAGS to enable new patches. --- gnu/local.mk | 4 +- gnu/packages/chez.scm | 5 ++ gnu/packages/patches/chez-scheme-bin-sh.patch | 66 +++++++++++++++++++ .../patches/racket-chez-scheme-bin-sh.patch | 66 +++++++++++++++++++ ...-rktio.patch => racket-rktio-bin-sh.patch} | 28 ++++---- gnu/packages/racket.scm | 5 +- 6 files changed, 158 insertions(+), 16 deletions(-) create mode 100644 gnu/packages/patches/chez-scheme-bin-sh.patch create mode 100644 gnu/packages/patches/racket-chez-scheme-bin-sh.patch rename gnu/packages/patches/{racket-minimal-sh-via-rktio.patch => racket-rktio-bin-sh.patch} (79%) diff --git a/gnu/local.mk b/gnu/local.mk index 234f21ad33..e827feed36 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -940,6 +940,7 @@ dist_patch_DATA = \ %D%/packages/patches/ceph-boost-compat.patch \ %D%/packages/patches/ceph-rocksdb-compat.patch \ %D%/packages/patches/cheese-vala-update.patch \ + %D%/packages/patches/chez-scheme-bin-sh.patch \ %D%/packages/patches/chmlib-inttypes.patch \ %D%/packages/patches/cl-asdf-config-directories.patch \ %D%/packages/patches/clamav-config-llvm-libs.patch \ @@ -1769,7 +1770,8 @@ dist_patch_DATA = \ %D%/packages/patches/ripperx-missing-file.patch \ %D%/packages/patches/rpcbind-CVE-2017-8779.patch \ %D%/packages/patches/rtags-separate-rct.patch \ - %D%/packages/patches/racket-minimal-sh-via-rktio.patch \ + %D%/packages/patches/racket-chez-scheme-bin-sh.patch \ + %D%/packages/patches/racket-rktio-bin-sh.patch \ %D%/packages/patches/remake-impure-dirs.patch \ %D%/packages/patches/restic-0.9.6-fix-tests-for-go1.15.patch \ %D%/packages/patches/retroarch-LIBRETRO_DIRECTORY.patch \ diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm index 4c253effa0..66098c7a24 100644 --- a/gnu/packages/chez.scm +++ b/gnu/packages/chez.scm @@ -34,6 +34,7 @@ (define-module (gnu packages chez) #:use-module (guix build-system copy) #:use-module (guix build-system gnu) #:use-module (guix build-system copy) + #:use-module (gnu packages bash) #:use-module (gnu packages compression) #:use-module (gnu packages ncurses) #:use-module (gnu packages ghostscript) @@ -269,6 +270,7 @@ (define-public chez-scheme (base32 "0xchqq8cm0ka5wgpn18sjs0hh15rc3nb7xrjqbbc9al3asq0d7gc")) (file-name (git-file-name name version)) + (patches (search-patches "chez-scheme-bin-sh.patch")) (snippet #~(begin (use-modules (guix build utils)) ;; TODO: consider putting this in a (guix ...) or @@ -287,6 +289,7 @@ (define-public chez-scheme `(,util-linux "lib") ;<-- libuuid zlib lz4 + bash-minimal ;<-- for process ncurses ;<-- for expeditor ;; for X11 clipboard support in expeditor: ;; https://github.com/cisco/ChezScheme/issues/9#issuecomment-222057232 @@ -313,6 +316,8 @@ (define-public chez-scheme (cut memq 'threads <>)) #~("--threads") #~()) + ,(string-append "CPPFLAGS=-DGUIX_RKTIO_BIN_SH=" + #$(file-append bash-minimal "/bin/sh")) "ZLIB=-lz" "LZ4=-llz4" "--libkernel" diff --git a/gnu/packages/patches/chez-scheme-bin-sh.patch b/gnu/packages/patches/chez-scheme-bin-sh.patch new file mode 100644 index 0000000000..e6228e3264 --- /dev/null +++ b/gnu/packages/patches/chez-scheme-bin-sh.patch @@ -0,0 +1,66 @@ +From c170f0f3a326f293ee1f460a70303382966ca41b Mon Sep 17 00:00:00 2001 +From: Philip McGrath +Date: Thu, 19 May 2022 13:41:56 -0400 +Subject: [PATCH] patch s_process for "/bin/sh" on Guix + +This patch reuses the C preprocessor macro `GUIX_RKTIO_BIN_SH` +from a previous patch. + +If: + + 1. The `GUIX_RKTIO_BIN_SH` macro is defined; and + + 2. The path specified by `GUIX_RKTIO_BIN_SH` exists; + +then `s_process` will call `execl` with the file specified by +`GUIX_RKTIO_BIN_SH` instead of "/bin/sh". + +This patch does not change the behavior of `s_system`, which relies +on `system` from the C library. +--- + c/prim5.c | 20 +++++++++++++++++++- + 1 file changed, 19 insertions(+), 1 deletion(-) + +diff --git a/c/prim5.c b/c/prim5.c +index 5a07893..926d68d 100644 +--- a/c/prim5.c ++++ b/c/prim5.c +@@ -746,6 +746,22 @@ static ptr s_process(char *s, IBOOL stderrp) { + + INT tofds[2], fromfds[2], errfds[2]; + struct sigaction act, oint_act; ++ /* BEGIN PATCH for Guix */ ++#if defined(GUIX_RKTIO_BIN_SH) ++# define GUIX_AS_a_STR_HELPER(x) #x ++# define GUIX_AS_a_STR(x) GUIX_AS_a_STR_HELPER(x) ++ /* A level of indirection makes `#` work as needed: */ ++ struct stat guix_stat_buf; ++ char *guix_sh = ++ (0 == stat(GUIX_AS_a_STR(GUIX_RKTIO_BIN_SH), &guix_stat_buf)) ++ ? GUIX_AS_a_STR(GUIX_RKTIO_BIN_SH) ++ : "/bin/sh"; ++# undef GUIX_AS_a_STR ++# undef GUIX_AS_a_STR_HELPER ++#else /* GUIX_RKTIO_BIN_SH */ ++ char *guix_sh = "/bin/sh"; ++#endif ++ /* END PATCH for Guix */ + + if (pipe(tofds)) S_error("process","cannot open pipes"); + if (pipe(fromfds)) { +@@ -771,7 +787,9 @@ static ptr s_process(char *s, IBOOL stderrp) { + CLOSE(1); if (dup(fromfds[1]) != 1) _exit(1); + CLOSE(2); if (dup(stderrp ? errfds[1] : 1) != 2) _exit(1); + {INT i; for (i = 3; i < NOFILE; i++) (void)CLOSE(i);} +- execl("/bin/sh", "/bin/sh", "-c", s, NULL); ++ /* BEGIN PATCH for Guix */ ++ execl(guix_sh, guix_sh, "-c", s, NULL); ++ /* END PATCH for Guix */ + _exit(1) /* only if execl fails */; + /*NOTREACHED*/ + } else { + +base-commit: 9df56e7b25bc523663eac3da24be33afc5f76c84 +-- +2.32.0 + diff --git a/gnu/packages/patches/racket-chez-scheme-bin-sh.patch b/gnu/packages/patches/racket-chez-scheme-bin-sh.patch new file mode 100644 index 0000000000..df2eb671b3 --- /dev/null +++ b/gnu/packages/patches/racket-chez-scheme-bin-sh.patch @@ -0,0 +1,66 @@ +From 5f3fc12bf123f30485800960b0493f5dd538d107 Mon Sep 17 00:00:00 2001 +From: Philip McGrath +Date: Thu, 19 May 2022 13:41:56 -0400 +Subject: [PATCH] Chez Scheme: patch s_process for "/bin/sh" on Guix + +This patch reuses the C preprocessor macro `GUIX_RKTIO_BIN_SH` +from a previous patch. + +If: + + 1. The `GUIX_RKTIO_BIN_SH` macro is defined; and + + 2. The path specified by `GUIX_RKTIO_BIN_SH` exists; + +then `s_process` will call `execl` with the file specified by +`GUIX_RKTIO_BIN_SH` instead of "/bin/sh". + +This patch does not change the behavior of `s_system`, which relies +on `system` from the C library. +--- + racket/src/ChezScheme/c/prim5.c | 20 +++++++++++++++++++- + 1 file changed, 19 insertions(+), 1 deletion(-) + +diff --git a/racket/src/ChezScheme/c/prim5.c b/racket/src/ChezScheme/c/prim5.c +index f5e3e345be..9db2989138 100644 +--- a/racket/src/ChezScheme/c/prim5.c ++++ b/racket/src/ChezScheme/c/prim5.c +@@ -856,6 +856,22 @@ static ptr s_process(s, stderrp) char *s; IBOOL stderrp; { + + INT tofds[2], fromfds[2], errfds[2]; + struct sigaction act, oint_act; ++ /* BEGIN PATCH for Guix */ ++#if defined(GUIX_RKTIO_BIN_SH) ++# define GUIX_AS_a_STR_HELPER(x) #x ++# define GUIX_AS_a_STR(x) GUIX_AS_a_STR_HELPER(x) ++ /* A level of indirection makes `#` work as needed: */ ++ struct stat guix_stat_buf; ++ char *guix_sh = ++ (0 == stat(GUIX_AS_a_STR(GUIX_RKTIO_BIN_SH), &guix_stat_buf)) ++ ? GUIX_AS_a_STR(GUIX_RKTIO_BIN_SH) ++ : "/bin/sh"; ++# undef GUIX_AS_a_STR ++# undef GUIX_AS_a_STR_HELPER ++#else /* GUIX_RKTIO_BIN_SH */ ++ char *guix_sh = "/bin/sh"; ++#endif ++ /* END PATCH for Guix */ + + if (pipe(tofds)) S_error("process","cannot open pipes"); + if (pipe(fromfds)) { +@@ -881,7 +897,9 @@ static ptr s_process(s, stderrp) char *s; IBOOL stderrp; { + CLOSE(1); if (dup(fromfds[1]) != 1) _exit(1); + CLOSE(2); if (dup(stderrp ? errfds[1] : 1) != 2) _exit(1); + {INT i; for (i = 3; i < NOFILE; i++) (void)CLOSE(i);} +- execl("/bin/sh", "/bin/sh", "-c", s, NULL); ++ /* BEGIN PATCH for Guix */ ++ execl(guix_sh, guix_sh, "-c", s, NULL); ++ /* END PATCH for Guix */ + _exit(1) /* only if execl fails */; + /*NOTREACHED*/ + } else { + +base-commit: 9d228d16fb99c274c964e5bef93e97333888769f +-- +2.32.0 + diff --git a/gnu/packages/patches/racket-minimal-sh-via-rktio.patch b/gnu/packages/patches/racket-rktio-bin-sh.patch similarity index 79% rename from gnu/packages/patches/racket-minimal-sh-via-rktio.patch rename to gnu/packages/patches/racket-rktio-bin-sh.patch index 6bc2ee8331..4f7f2da083 100644 --- a/gnu/packages/patches/racket-minimal-sh-via-rktio.patch +++ b/gnu/packages/patches/racket-rktio-bin-sh.patch @@ -1,7 +1,7 @@ -From 3574b567c486d264d680a37586436c3b5a8cb978 Mon Sep 17 00:00:00 2001 +From 070abbcc0d880ca4f97f997e096ac66650ccaaa0 Mon Sep 17 00:00:00 2001 From: Philip McGrath Date: Thu, 4 Mar 2021 04:11:50 -0500 -Subject: [PATCH] patch rktio_process for "/bin/sh" on Guix +Subject: [PATCH] rktio: patch rktio_process for "/bin/sh" on Guix Racket provides the functions `system` and `process`, which execute shell commands using `sh` (or `cmd` on Windows). @@ -13,17 +13,17 @@ the C function that implements the core of `system`, `process`, and related Racket functions. Guix should enable the special case by defining the C preprocessor -macro `GUIX_RKTIO_PATCH_BIN_SH` with the path to `sh` in the store. +macro `GUIX_RKTIO_BIN_SH` with the path to `sh` in the store. If: - 1. The `GUIX_RKTIO_PATCH_BIN_SH` macro is defined; and + 1. The `GUIX_RKTIO_BIN_SH` macro is defined; and 2. `rktio_process` is called with the exact path "/bin/sh"; and - 3. The path specified by `GUIX_RKTIO_PATCH_BIN_SH` does exists; + 3. The file specified by `GUIX_RKTIO_BIN_SH` exists; then `rktio_process` will execute the file specified -by `GUIX_RKTIO_PATCH_BIN_SH` instead of "/bin/sh". +by `GUIX_RKTIO_BIN_SH` instead of "/bin/sh". Compared to previous attempts to patch the Racket sources, making this change at the C level is both: @@ -39,10 +39,10 @@ making this change at the C level is both: 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/racket/src/rktio/rktio_process.c b/racket/src/rktio/rktio_process.c -index 89202436c0..465ebdd5c5 100644 +index fafaf728c1..0a319b381a 100644 --- a/racket/src/rktio/rktio_process.c +++ b/racket/src/rktio/rktio_process.c -@@ -1224,12 +1224,14 @@ int rktio_process_allowed_flags(rktio_t *rktio) +@@ -1301,12 +1301,14 @@ int rktio_process_allowed_flags(rktio_t *rktio) /*========================================================================*/ rktio_process_result_t *rktio_process(rktio_t *rktio, @@ -58,19 +58,19 @@ index 89202436c0..465ebdd5c5 100644 rktio_process_result_t *result; intptr_t to_subprocess[2], from_subprocess[2], err_subprocess[2]; int pid; -@@ -1255,6 +1257,23 @@ rktio_process_result_t *rktio_process(rktio_t *rktio, +@@ -1333,6 +1335,23 @@ rktio_process_result_t *rktio_process(rktio_t *rktio, int i; #endif +/* BEGIN PATCH for Guix */ -+#if defined(GUIX_RKTIO_PATCH_BIN_SH) ++#if defined(GUIX_RKTIO_BIN_SH) +# define GUIX_AS_a_STR_HELPER(x) #x +# define GUIX_AS_a_STR(x) GUIX_AS_a_STR_HELPER(x) + /* A level of indirection makes `#` work as needed: */ + command = + ((0 == strcmp(_guix_orig_command, "/bin/sh")) -+ && rktio_file_exists(rktio, GUIX_AS_a_STR(GUIX_RKTIO_PATCH_BIN_SH))) -+ ? GUIX_AS_a_STR(GUIX_RKTIO_PATCH_BIN_SH) ++ && rktio_file_exists(rktio, GUIX_AS_a_STR(GUIX_RKTIO_BIN_SH))) ++ ? GUIX_AS_a_STR(GUIX_RKTIO_BIN_SH) + : _guix_orig_command; +# undef GUIX_AS_a_STR +# undef GUIX_AS_a_STR_HELPER @@ -82,6 +82,8 @@ index 89202436c0..465ebdd5c5 100644 /* avoid compiler warnings: */ to_subprocess[0] = -1; to_subprocess[1] = -1; + +base-commit: 9d228d16fb99c274c964e5bef93e97333888769f -- -2.21.1 (Apple Git-122.3) +2.32.0 diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm index 3399bcc3fe..cddb617232 100644 --- a/gnu/packages/racket.scm +++ b/gnu/packages/racket.scm @@ -212,7 +212,8 @@ (define %racket-origin (sha256 (base32 "0f9zyhdvbh4xsndrqjzl85j5ziz0rmqi676g9s1lw3h3skq2636h")) (file-name (git-file-name "racket" %racket-version)) - (patches (search-patches "racket-minimal-sh-via-rktio.patch")) + (patches (search-patches "racket-chez-scheme-bin-sh.patch" + "racket-rktio-bin-sh.patch")) (modules '((guix build utils))) (snippet #~(begin @@ -248,7 +249,7 @@ (define (racket-vm-common-configure-flags) (list (string-append "--enable-racket=" racket)))) (else '())) - ,(string-append "CPPFLAGS=-DGUIX_RKTIO_PATCH_BIN_SH=" + ,(string-append "CPPFLAGS=-DGUIX_RKTIO_BIN_SH=" #$(file-append bash-minimal "/bin/sh")) "--disable-strip" ;; Using --enable-origtree lets us distinguish the VM from subsequent -- 2.32.0