From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id GEUUDDRpCmNlQAAAbAwnHQ (envelope-from ) for ; Sat, 27 Aug 2022 20:57:56 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id k28LDDRpCmN7qgAAauVa8A (envelope-from ) for ; Sat, 27 Aug 2022 20:57:56 +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 E73311459E for ; Sat, 27 Aug 2022 20:57:55 +0200 (CEST) Received: from localhost ([::1]:39796 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oS10F-0003qF-4K for larch@yhetil.org; Sat, 27 Aug 2022 14:57:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49546) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oS0zQ-00035q-ED for guix-patches@gnu.org; Sat, 27 Aug 2022 14:57:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:39077) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oS0zQ-0001W4-60 for guix-patches@gnu.org; Sat, 27 Aug 2022 14:57:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oS0zQ-0008Fc-2W for guix-patches@gnu.org; Sat, 27 Aug 2022 14:57:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#57050] [PATCH v4 05/14] gnu: racket: Adjust patch for "/bin/sh" in rktio. Resent-From: Philip McGrath Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 27 Aug 2022 18:57:04 +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 , Thiago Jung Bauermann , "\(" , Maxime Devos , Liliana Marie Prikler , Efraim Flashner , Liliana Marie Prikler Received: via spool by 57050-submit@debbugs.gnu.org id=B57050.166162661331643 (code B ref 57050); Sat, 27 Aug 2022 18:57:04 +0000 Received: (at 57050) by debbugs.gnu.org; 27 Aug 2022 18:56:53 +0000 Received: from localhost ([127.0.0.1]:57047 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oS0zE-0008EC-Ur for submit@debbugs.gnu.org; Sat, 27 Aug 2022 14:56:53 -0400 Received: from mail-vs1-f41.google.com ([209.85.217.41]:41734) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oS0z6-0008Df-PH for 57050@debbugs.gnu.org; Sat, 27 Aug 2022 14:56:45 -0400 Received: by mail-vs1-f41.google.com with SMTP id k2so4666157vsk.8 for <57050@debbugs.gnu.org>; Sat, 27 Aug 2022 11:56:44 -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=zh/Tp+3ORrasgKkcLxEkrCSbNxjvWOrzb6PDcb/hl00=; b=TFOuidhqSEjQkF/FuFihcDBSio1v1ujz+CokH8johPugipJVY91O2NgzSwZDeOJbQ5 QYQpTCH1Sxlout2JZ4jmWEX3xwE0/gRSl3hK+6p6IRlP1QKGnjZzNV/TO38fp9/pqs7A AO9rdnutgocZXC/J4c54HnrGourMN2fR0lGVuOXBrj6LUfIJY+4maPssOvewVNJiU4z4 yrse4/wNP2RUOtpfFKKuiyJ18W1kldWT01wf8/VRL+r50VYO0QMPnJTDzt3yjUtfR+cH 8+A/B7mF1dxJgrQD1ydTSpcgGskuyYlkn76FYrj9Wk8b5hhVD9DtsH4ZKmYFd6XfF7dj PVeQ== 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=zh/Tp+3ORrasgKkcLxEkrCSbNxjvWOrzb6PDcb/hl00=; b=ACROYwtongjrEYR5PXvRSfprgtpnQIhD5ssfs4m6xq6kjJjNS9OxP8OCRjbWl8lEyC Z5pkyo5PFTF5RDOc1BJ9bg9zE5BD7ErUTowPp75pPosjSyUzIbZAE37Ql55WmpAMqeFO pUz9CCoyuO15v9ZGfDZqQwZOS1A6JqgrSG9xUjTJpyn3k62UOabFbiR+VPHemAC6gfTq D7+7V5vdakHQeSI9tGyKGj/FC63Y5eYcrrLd5tHaas6Ys3xs/4vTUrdTH4aUPTepsZ1e 72Ff0gv/NCs4s9sXyGD3gDypsB0o/3vmxKOULG47SbSymLxMym+AdtASAujitqk5sW7r 0nRg== X-Gm-Message-State: ACgBeo0Om5s9cW8pHsknb/Htj/B1EH8Y0yzzHuo5TfFDEQM1mT1CPF07 qPQNQFtmFTbHEk3ib4ssrJjFtopXsPJz0+S/ X-Google-Smtp-Source: AA6agR5dnQjJ4lY+9tKUW7VpZbC4YEuNOr47EaQsc3c5vJB3+2OrOL0fJg3uqSygXlCrx+q0L9m+1g== X-Received: by 2002:a67:1ac6:0:b0:38c:95f2:c141 with SMTP id a189-20020a671ac6000000b0038c95f2c141mr1514463vsa.77.1661626599064; Sat, 27 Aug 2022 11:56:39 -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 x2-20020a67fc82000000b00385d88375f4sm700321vsp.32.2022.08.27.11.56.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 27 Aug 2022 11:56:38 -0700 (PDT) From: Philip McGrath Date: Sat, 27 Aug 2022 14:55:45 -0400 Message-Id: <05bbd3ccda12d47c22c6df15b505ba76e7facebd.1661626113.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=1661626676; 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=zh/Tp+3ORrasgKkcLxEkrCSbNxjvWOrzb6PDcb/hl00=; b=ILk8WppGZoKfc8PNgJkFj396EYsfs/fHVmtl+xrzssRMH2VBQzdse0j1scVZLeAeiB2wkh hfFMxJERqcUMt4rpTIcaN0DAi05hcCGodQwG5TDPRsT/R4lFEqskoD85kHrBgVfNMSfXr4 0tVuHYFx9xN3NsnKozaL4VGSg4OOmVotKqaPesz9fuYNRmjQUp02zP8rxHITexfEbvFql/ Hes2jSI5jG5GFEWuLdpltImrITQT2rYR4MwK5KVUEEGv7e7+B6FPrlRMG1+RUYTlR7sKhn 6v18jyUD1bzps58SEfSXLXqwcNwkydy5OIQsTZcZMhyn5Z8oybmabAOXPQ83Uw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1661626676; a=rsa-sha256; cv=none; b=dxnNDHNOybI95iyQZsxtjRhNdyK2lEzy9VSbAw49dLfwEpA5iBRE4BrLzVdNIz80egXxcM Mpo0Qb51xPiV/X2nBkFRSlcN27X2CVdkHqxsk2gVukTKbLwvFKpmEUgQW8ndFiQt7q2bJl 4XshC5hVJhEQ9rb2lC7EzJW1ABtUvwOFTPTrszBV5MKTssxKPSSA7x0mE4iBH/vBeYqMkX a4ApaBA6izrjIIdrEeDde4X4bcrLw5HLX4uedXw90IJU4nSYHkeVBxNP8awJvEUgpyPlbH iLgL2fillV86XsQAW8D+n8hHD/NDaFrrPrtOZHkVijtwCyqq0zDj/fFOxAqJeA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=philipmcgrath.com header.s=google header.b=TFOuidhq; 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: 5.70 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=philipmcgrath.com header.s=google header.b=TFOuidhq; 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: E73311459E X-Spam-Score: 5.70 X-Migadu-Scanner: scn1.migadu.com X-TUID: S4eypkUYrGn3 Use '_PATH_BSHELL' instead of a custom preprocessor macro. This may not be The Right Thing in the long term, but it at least avoids a proliferation of 'CPPFLAGS'. * gnu/packages/patches/racket-minimal-sh-via-rktio.patch: Rename to ... * gnu/packages/patches/racket-rktio-bin-sh.patch: ... this, and change to use '_PATH_BSHELL'. * gnu/local.mk (dist_patch_DATA): Update accordingly. * gnu/packages/racket.scm (%racket-origin)[patches]: Likewise. (racket-vm-common-configure-flags): Stop setting 'CPPFLAGS'. Change to a constant instead of a function, since we no longer need the delay. (racket-vm-cgc, racket-vm-bc, racket-vm-cs)[arguments]<#:configure-flags>: Update accordingly. [inputs]: Remove 'bash-minimal'. --- gnu/local.mk | 2 +- ...-rktio.patch => racket-rktio-bin-sh.patch} | 60 +++++++++---------- gnu/packages/racket.scm | 15 ++--- 3 files changed, 35 insertions(+), 42 deletions(-) rename gnu/packages/patches/{racket-minimal-sh-via-rktio.patch => racket-rktio-bin-sh.patch} (54%) diff --git a/gnu/local.mk b/gnu/local.mk index 558fed8a0d..fae32a11e5 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1768,7 +1768,7 @@ 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-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/patches/racket-minimal-sh-via-rktio.patch b/gnu/packages/patches/racket-rktio-bin-sh.patch similarity index 54% rename from gnu/packages/patches/racket-minimal-sh-via-rktio.patch rename to gnu/packages/patches/racket-rktio-bin-sh.patch index 6bc2ee8331..ec6f0d9c56 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 6a553f24439fe64fd3a2f0b5902f00590ca4241f 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). @@ -12,37 +12,38 @@ This patch adds a special case for "/bin/sh" to `rktio_process`, 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. If: - 1. The `GUIX_RKTIO_PATCH_BIN_SH` macro is defined; and + 1. The nonstandard but ubiquitous macro `_PATH_BSHELL` from + 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 `_PATH_BSHELL` exists; -then `rktio_process` will execute the file specified -by `GUIX_RKTIO_PATCH_BIN_SH` instead of "/bin/sh". +then `rktio_process` will execute the file specified by `_PATH_BSHELL` +instead of "/bin/sh". -Compared to previous attempts to patch the Racket sources, -making this change at the C level is both: - - - More comprehensive: it catches all attempts to execute "/bin/sh", - without having to track down the source of every occurance; and - - - Less intrusive: by guarding the special case with a C preprocessor - conditional and a runtime check that the file in the store exists, - we make it much less likely that it will "leak" out of Guix. +Checking that the path specified by `_PATH_BSHELL` exists safeguards +against obscure errors if attempting to use stand-alone executables +built by the patched Racket in non-Guix envoronments. --- - racket/src/rktio/rktio_process.c | 21 ++++++++++++++++++++- - 1 file changed, 20 insertions(+), 1 deletion(-) + racket/src/rktio/rktio_process.c | 17 ++++++++++++++++- + 1 file changed, 16 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..796ebc59ce 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) +@@ -9,6 +9,7 @@ + # include + # include + # include ++# include /* PATCHED for Guix */ + # ifdef USE_ULIMIT + # include + # endif +@@ -1301,12 +1302,14 @@ int rktio_process_allowed_flags(rktio_t *rktio) /*========================================================================*/ rktio_process_result_t *rktio_process(rktio_t *rktio, @@ -58,22 +59,17 @@ 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 +1336,18 @@ rktio_process_result_t *rktio_process(rktio_t *rktio, int i; #endif +/* BEGIN PATCH for Guix */ -+#if defined(GUIX_RKTIO_PATCH_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: */ ++#if defined(_PATH_BSHELL) + 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, _PATH_BSHELL)) ++ ? _PATH_BSHELL + : _guix_orig_command; -+# undef GUIX_AS_a_STR -+# undef GUIX_AS_a_STR_HELPER +#else + command = _guix_orig_command; +#endif @@ -82,6 +78,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..319f63f9d2 100644 --- a/gnu/packages/racket.scm +++ b/gnu/packages/racket.scm @@ -36,7 +36,6 @@ (define-module (gnu packages racket) #:use-module (ice-9 match) #:use-module (gnu packages) #:use-module (gnu packages autotools) - #:use-module (gnu packages bash) #:use-module (gnu packages chez) #:use-module (gnu packages compression) #:use-module (gnu packages databases) @@ -212,7 +211,7 @@ (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-rktio-bin-sh.patch")) (modules '((guix build utils))) (snippet #~(begin @@ -232,8 +231,7 @@ (define %racket-origin ;; Unbundle libffi. (delete-file-recursively "racket/src/bc/foreign/libffi"))))) -(define (racket-vm-common-configure-flags) - ;; under a lambda abstraction to avoid evaluating bash-minimal too early. +(define racket-vm-common-configure-flags #~`(,@(cond ((false-if-exception (search-input-file %build-inputs "/bin/libtool")) @@ -248,8 +246,6 @@ (define (racket-vm-common-configure-flags) (list (string-append "--enable-racket=" racket)))) (else '())) - ,(string-append "CPPFLAGS=-DGUIX_RKTIO_PATCH_BIN_SH=" - #$(file-append bash-minimal "/bin/sh")) "--disable-strip" ;; Using --enable-origtree lets us distinguish the VM from subsequent ;; layers and produces a build with the shape expected by tools such as @@ -267,7 +263,6 @@ (define-public racket-vm-cgc (version %racket-version) (source %racket-origin) (inputs (list ncurses ;; <- common to all variants (for #%terminal) - bash-minimal ;; <- common to all variants (for `system`) libffi)) ;; <- only for BC variants (native-inputs (list libtool)) ;; <- only for BC variants (outputs '("out" "debug")) @@ -276,7 +271,7 @@ (define-public racket-vm-cgc (list #:configure-flags #~(cons "--enable-cgcdefault" - #$(racket-vm-common-configure-flags)) + #$racket-vm-common-configure-flags) ;; Tests are in packages like racket-test-core and ;; main-distribution-test that aren't part of the main ;; distribution. @@ -359,7 +354,7 @@ (define-public racket-vm-bc (substitute-keyword-arguments (package-arguments racket-vm-cgc) ((#:configure-flags _ '()) #~(cons "--enable-bconly" - #$(racket-vm-common-configure-flags))))) + #$racket-vm-common-configure-flags)))) (synopsis "Racket BC [3M] implementation") (description "The Racket BC (``before Chez'' or ``bytecode'') implementation was the default before Racket 8.0. It uses a compiler written @@ -405,7 +400,7 @@ (define-public racket-vm-cs #$(this-package-native-input "chez-scheme-for-racket") "/bin/scheme") - #$(racket-vm-common-configure-flags))))) + #$racket-vm-common-configure-flags)))) (synopsis "Racket CS implementation") (description "The Racket CS implementation, which uses ``Chez Scheme'' as its core compiler and runtime system, has been the default Racket VM -- 2.32.0