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 QCTeCCg+B2Mo0AAAbAwnHQ (envelope-from ) for ; Thu, 25 Aug 2022 11:17:28 +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 yP6oCCg+B2MSbQEAauVa8A (envelope-from ) for ; Thu, 25 Aug 2022 11:17:28 +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 8C88C1DFAF for ; Thu, 25 Aug 2022 11:17:27 +0200 (CEST) Received: from localhost ([::1]:39624 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oR8zO-0000sD-8l for larch@yhetil.org; Thu, 25 Aug 2022 05:17:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51966) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oR8ek-0000kX-9n for guix-patches@gnu.org; Thu, 25 Aug 2022 04:56:10 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:59138) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oR8ei-000309-91 for guix-patches@gnu.org; Thu, 25 Aug 2022 04:56:06 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oR8ei-0002ZS-4T for guix-patches@gnu.org; Thu, 25 Aug 2022 04:56:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#57050] [PATCH v3 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: Thu, 25 Aug 2022 08:56: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.16614177559813 (code B ref 57050); Thu, 25 Aug 2022 08:56:04 +0000 Received: (at 57050) by debbugs.gnu.org; 25 Aug 2022 08:55:55 +0000 Received: from localhost ([127.0.0.1]:48876 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oR8eX-0002Xy-Sb for submit@debbugs.gnu.org; Thu, 25 Aug 2022 04:55:55 -0400 Received: from mail-vk1-f179.google.com ([209.85.221.179]:45577) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oR8eI-0002XJ-Nb for 57050@debbugs.gnu.org; Thu, 25 Aug 2022 04:55:39 -0400 Received: by mail-vk1-f179.google.com with SMTP id t64so9861784vkb.12 for <57050@debbugs.gnu.org>; Thu, 25 Aug 2022 01:55:38 -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=OtsFs2rdjiR2l4Q2retTZWWRdpjXx5L0kHc/tcdwu8AkSk+w2SJ4SwNXfPz4AvSxDC 7H+Hji4xStTushvvaSOdmktVSenAHC4jCHphqImr+vE9bIq1+2zdhFLaCuvalS0ppzJ0 c9TBPRue/3t36xwWc/O7DzFd1RbkbdXkCPyn97mn/C6fAG7xx7H1ijGDreqd8opKcB0u uJlIR8+qKtOIoDA7faJABXH/Ww8sequ6gqXIAoS3zgB/J6M+izxvUW/bPQRKqXloniFH ygE0OpwMs1hB+5s+2tMeRqAxXARsBjiFHlw/GFwQYIBRmCwXhbtL4ZpLURCzAK19nlye SVKA== 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=yRbINf/FEl9z0wIs+3bUtt3noqKEH6CXss2V0HrL4RLwlfmXHDbJyb/vUuTws2FhiU Mig5+0l01nHXoinuVzpjWw8Y+dT/k3BZ0adQ+xCoY4/O83WSqoNwsMZ5026OqVwFyl8W 51toA6GA5DUfFYIcaPKbN5LgH4/8ESnYp4kkfJwQm8CbLrWbcp4WBYYYpiwkTszFlV8e v1L3Whwb3i2E6E9RZMWt0rMTU42tprI6/lMjr36Frl8dfx1NDKNEW6bc70QCSS+6txTH CH7iwCNoT3xFiejgBBAPpiq6brIM1i8V+wbIK2M50TMMWwAzfiP/DyQJwfBKfiHQbgSD +QlA== X-Gm-Message-State: ACgBeo0/3Lliw52HSbncquEoYHSyezmLVZnbyrzd5qpfnw//crN1mrm/ H7ITyxzcTKSvjbvBdGj2D/0eb5GQmJP9Mun6 X-Google-Smtp-Source: AA6agR7ggJrtjnO1G8YCa5OPBPgBR48B54o6V7U42XXFG1AFjl8Uy4sB2MiXQESNPudeV6gikLGnPA== X-Received: by 2002:a1f:9002:0:b0:377:1433:93e9 with SMTP id s2-20020a1f9002000000b00377143393e9mr993845vkd.28.1661417733020; Thu, 25 Aug 2022 01:55:33 -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 f11-20020a67ee0b000000b003904a0d214esm9681238vsp.3.2022.08.25.01.55.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 25 Aug 2022 01:55:32 -0700 (PDT) From: Philip McGrath Date: Thu, 25 Aug 2022 04:54:07 -0400 Message-Id: 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=1661419047; 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=KUmUFMrlvMF9lIVGMbXb9bPKpfo7ECLMdmygWh4/FHSiEYDWOyMIFrhROqWJ8KEFSbfMnH IWyMLJOlldlZF5EjkwDuKUA78d3p65VS+gs7qE2s6PhKlU3nymypcad29k95LdRgVGwzQz pCmwE+/9UwXAclCemzsmxYlYeofBSqrFW5ocdZuykYFKFG/I2F8m7olmxy7GgOYNyT2RAf Q2XPKpXGluLsB4F8tgCa7Hjp6LeX+jG5pUTiA5iYhglUvyr2RkPcAxs7ggSI7FMqANr5yL Kw6T943K3ICh+TOb5VCWMZ1Fo9rjY1To4nnhAuNFgogZDvbl6DA/FcF3yihf5Q== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1661419047; a=rsa-sha256; cv=none; b=iRlDDOncwz7LhY5A+w7semPwCU9EefLqfi47zLfZ16QPfh6iNIXSwP/x5vK7SdGTrcFDGW oyBSd9A77o7+c0wXyKzmH8O9AJ5DpICclOAcaIfoUjFUKRDFewTcz3izudErmLXzvZNzv0 8QcGk401WufVnfktADfsi+QTr53vsRtUi6w1Azk6fS3W/yHXWq3QILl1pS5ay2rVgEH6SW sua4RWgTypP0GRjVExGH69mbA9z0SC5kiZMgESd+tPQjLqFvxfnNy/UVhg/Be6850pSlU8 bGE+hvlaS5F1uf3nsO3YO7vt5968B2Pp6ba7s2FQzCHIaHISkvz9FYKZSpN0sw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=philipmcgrath.com header.s=google header.b=OtsFs2rd; 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: 3.69 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=philipmcgrath.com header.s=google header.b=OtsFs2rd; 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: 8C88C1DFAF X-Spam-Score: 3.69 X-Migadu-Scanner: scn0.migadu.com X-TUID: yUtwmMBqJU4j 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