From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.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 cDPPN2g5B2MHXwEAbAwnHQ (envelope-from ) for ; Thu, 25 Aug 2022 10:57:12 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id wGHTN2g5B2N0RQEA9RJhRA (envelope-from ) for ; Thu, 25 Aug 2022 10:57:12 +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 8C0871D5C3 for ; Thu, 25 Aug 2022 10:57:12 +0200 (CEST) Received: from localhost ([::1]:56068 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oR8fn-00020I-LU for larch@yhetil.org; Thu, 25 Aug 2022 04:57:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51970) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oR8ek-0000kZ-Ab for guix-patches@gnu.org; Thu, 25 Aug 2022 04:56:10 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:59139) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oR8ei-00030A-Rs 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-0002Za-Me for guix-patches@gnu.org; Thu, 25 Aug 2022 04:56:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#57050] [PATCH v3 06/14] gnu: chez-scheme: Fix use of "/bin/sh". 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.16614177569821 (code B ref 57050); Thu, 25 Aug 2022 08:56:04 +0000 Received: (at 57050) by debbugs.gnu.org; 25 Aug 2022 08:55:56 +0000 Received: from localhost ([127.0.0.1]:48879 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oR8eZ-0002YE-O9 for submit@debbugs.gnu.org; Thu, 25 Aug 2022 04:55:56 -0400 Received: from mail-vs1-f51.google.com ([209.85.217.51]:34480) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oR8eM-0002XN-N2 for 57050@debbugs.gnu.org; Thu, 25 Aug 2022 04:55:43 -0400 Received: by mail-vs1-f51.google.com with SMTP id q67so11459833vsa.1 for <57050@debbugs.gnu.org>; Thu, 25 Aug 2022 01:55:42 -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=fyJnmMnKmtISB2rntIQ/ske5rbxAqlvQx/iOqGlMAvs=; b=cut8mVkz4+4xl62yCiqEmrn2gUuH/lC421YRqGlhePY4VA2hdZJi5FYJ6WztQV+vA+ tem4Di+5h+3YbqjtwROTtiLE3ECj/13xgq8uvFZFUdyE8A9p3nYywotDA+JtvWZciNCo gZ812QTp+Q/+WjVjokzoxh4gQuVHFvtfcKTEpn5rCcsGZupsCh6B6tx7XApsIX2SjNHD 1JoBbU1iUrj/P8elbMIyaOauy8L05Gc6nPBJLTN1mQjhRbJfcLnAmTymIfyJupY+px7w Im2N0RwcBIqiLvm4WCMkGXH3d6b09D7Hk21YVVm6F/M4+xTk6/hUBIgOpK9Li0sc6w6y VBkA== 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=fyJnmMnKmtISB2rntIQ/ske5rbxAqlvQx/iOqGlMAvs=; b=tpI5bSI2Dp777FnFnX4q+YvfAtL0ct4IzU6Iz2rJi4tcxWduwHrvkQTMxWYG8goieE w6NiGyPtvH3t1RSLgYDQMX+RnDAOEgeGO2pADenztOl1QCW8UxGq1MjKBCqGTNotrv0N s6UTcbuDlACa+pFhQDzAh/vRDsCvLtKVg2bDLaT0ozEObdKIqehy3rlKxz+4j0zEZqyh kE7aTobzZ7MaxqAFMXYU6mC/wAzrNAo6QOeLxkCKiUyiCrB0+ZL2xwD2SvyCaoBe1+J0 lO8jmtwWnszPiYEKm9ZsYL59s08kh1sCCvpeH1T2aJPIUueVLmfg5LOOFNoYTLwq3s+U cklA== X-Gm-Message-State: ACgBeo0DNmn5bMI0WGMqd6uvB3YFRO8JHkeQ+3VkDT+tuP3A1dU8UwO3 2sAKtYQiXTEmYX3+t4I8WVtNYNFJzWh8xaXG X-Google-Smtp-Source: AA6agR5jPhtWifFdynDXAx6mFfQxcr/zJifGJnWzJRZ2KeW4Gk8GEDxmAllvGDsiqhwXxwKKfljYzw== X-Received: by 2002:a05:6102:3c4:b0:388:d643:a5b3 with SMTP id n4-20020a05610203c400b00388d643a5b3mr1111506vsq.21.1661417737059; Thu, 25 Aug 2022 01:55:37 -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 l11-20020a1f250b000000b003846b127feasm15254181vkl.48.2022.08.25.01.55.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 25 Aug 2022 01:55:36 -0700 (PDT) From: Philip McGrath Date: Thu, 25 Aug 2022 04:54:08 -0400 Message-Id: <109112fc6b4d2b21f5a322a266d51194a00ea2de.1661416343.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=1661417832; 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=fyJnmMnKmtISB2rntIQ/ske5rbxAqlvQx/iOqGlMAvs=; b=fq9fHXw4rlVVFJZrnC/9arnVXmeyacoaMK1vBQDzcSY3gQoCJ2A41rpzZE9ZaQrpAr9uHL jEZqO7hbMCfWvPTuRqQN+19H4HS83plVPiQgNkjfjAQ/BulldbAfmFniHuJWwS3xXnj1+8 +u7+KfbNU3JThqXL8kjPUSmUgLyqSK6NmD2F/MBT3xabgPMuMWfQlX8EUEODoNuBYXatxc 9Bta7JQjchgwhYV1VOttJhGH06SlHN3cY2OMcUoq2319gcaY6FFYDMdnn8Gl3cFOyyBaPp F6qE4ugtKSfdwmZ4xHFBScmAu7PC1jCvfCEAT4/ytcimOCAvQ/Gt9PAlW0TL8Q== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1661417832; a=rsa-sha256; cv=none; b=sHeq5FFs4w4CGytgLfsEdO90azOjEawQGlr449k8t9lsNYFbcdaQw0nlHy1K7i9GGAec27 wYuWqfKnExWYfx1of2qjGAf1rSZMyKMYUDv3x8LFCxQ2onBCp68SOtFJk2mfWkd0oDHk0M AlF2SZvUipnNIn1NKJhHOPKXOlAw/q+SoVn33dunAUJ6sOHfRV8Xewmp1HhQAFA1+7UdwV i8O4g2Hz+qUQTX5rMU0RuJkXOoKeisrJkodTcC8bskehKOAS1rpGTz1BmfQScTOYKdUEK3 8qpR/0jPbFiNFe4kL+EqsJITkTquz6G0TLYlg7Yqy7bmSPdKFPZpBp6ZRqK7bQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=philipmcgrath.com header.s=google header.b=cut8mVkz; 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: 4.19 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=philipmcgrath.com header.s=google header.b=cut8mVkz; 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: 8C0871D5C3 X-Spam-Score: 4.19 X-Migadu-Scanner: scn0.migadu.com X-TUID: QD5OKF0YDq51 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/local.mk (dist_patch_DATA): Add them. * gnu/packages/racket.scm (%racket-origin)[patches]: Update accordingly. * gnu/packages/chez.scm (chez-scheme)[origin]: Likewise. --- gnu/local.mk | 2 + gnu/packages/chez.scm | 1 + gnu/packages/patches/chez-scheme-bin-sh.patch | 76 +++++++++++++++++++ .../patches/racket-chez-scheme-bin-sh.patch | 76 +++++++++++++++++++ gnu/packages/racket.scm | 3 +- 5 files changed, 157 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/patches/chez-scheme-bin-sh.patch create mode 100644 gnu/packages/patches/racket-chez-scheme-bin-sh.patch diff --git a/gnu/local.mk b/gnu/local.mk index fae32a11e5..babd54c8c6 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -941,6 +941,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 \ @@ -1768,6 +1769,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-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 \ diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm index 812d41fc5b..c627c4d842 100644 --- a/gnu/packages/chez.scm +++ b/gnu/packages/chez.scm @@ -269,6 +269,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 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..7650914f01 --- /dev/null +++ b/gnu/packages/patches/chez-scheme-bin-sh.patch @@ -0,0 +1,76 @@ +From 3c838e6a0c3214d95bf02048cddccfd1b69a679f 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 + +If: + + 1. The nonstandard but ubiquitous macro `_PATH_BSHELL` from + is defined; and + + 2. The path specified by `_PATH_BSHELL` exists; + +then `s_process` will call `execl` with the file specified by +`_PATH_BSHELL` instead of "/bin/sh". + +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. + +This patch does not change the behavior of `s_system`, which relies +on `system` from the C library. +--- + c/prim5.c | 21 ++++++++++++++++++++- + 1 file changed, 20 insertions(+), 1 deletion(-) + +diff --git a/c/prim5.c b/c/prim5.c +index 5a07893..bc2736c 100644 +--- a/c/prim5.c ++++ b/c/prim5.c +@@ -23,6 +23,12 @@ + #include + #include + ++/* BEGIN PATCH for Guix */ ++#ifndef WIN32 ++# include ++#endif ++/* END PATCH for Guix */ ++ + /* locally defined functions */ + static INT s_errno(void); + static iptr s_addr_in_heap(uptr x); +@@ -746,6 +752,17 @@ 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(_PATH_BSHELL) ++ struct stat guix_stat_buf; ++ char *guix_sh = ++ (0 == stat(_PATH_BSHELL, &guix_stat_buf)) ++ ? _PATH_BSHELL ++ : "/bin/sh"; ++#else /* _PATH_BSHELL */ ++ char *guix_sh = "/bin/sh"; ++#endif ++ /* END PATCH for Guix */ + + if (pipe(tofds)) S_error("process","cannot open pipes"); + if (pipe(fromfds)) { +@@ -771,7 +788,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..65cf2f99f3 --- /dev/null +++ b/gnu/packages/patches/racket-chez-scheme-bin-sh.patch @@ -0,0 +1,76 @@ +From e982b6687494bf071386c67be74e57a29cf4ce00 Mon Sep 17 00:00:00 2001 +From: Philip McGrath +Date: Wed, 24 Aug 2022 19:55:14 -0400 +Subject: [PATCH] Chez Scheme: patch s_process for "/bin/sh" on Guix + +If: + + 1. The nonstandard but ubiquitous macro `_PATH_BSHELL` from + is defined; and + + 2. The path specified by `_PATH_BSHELL` exists; + +then `s_process` will call `execl` with the file specified by +`_PATH_BSHELL` instead of "/bin/sh". + +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. + +This patch does not change the behavior of `s_system`, which relies +on `system` from the C library. +--- + racket/src/ChezScheme/c/prim5.c | 21 ++++++++++++++++++++- + 1 file changed, 20 insertions(+), 1 deletion(-) + +diff --git a/racket/src/ChezScheme/c/prim5.c b/racket/src/ChezScheme/c/prim5.c +index f5e3e345be..922421ca75 100644 +--- a/racket/src/ChezScheme/c/prim5.c ++++ b/racket/src/ChezScheme/c/prim5.c +@@ -22,6 +22,12 @@ + #include + #include + ++/* BEGIN PATCH for Guix */ ++#ifndef WIN32 ++# include ++#endif ++/* END PATCH for Guix */ ++ + /* locally defined functions */ + static INT s_errno PROTO((void)); + static IBOOL s_addr_in_heap PROTO((uptr x)); +@@ -856,6 +862,17 @@ 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(_PATH_BSHELL) ++ struct stat guix_stat_buf; ++ char *guix_sh = ++ (0 == stat(_PATH_BSHELL, &guix_stat_buf)) ++ ? _PATH_BSHELL ++ : "/bin/sh"; ++#else /* _PATH_BSHELL */ ++ char *guix_sh = "/bin/sh"; ++#endif ++ /* END PATCH for Guix */ + + if (pipe(tofds)) S_error("process","cannot open pipes"); + if (pipe(fromfds)) { +@@ -881,7 +898,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/racket.scm b/gnu/packages/racket.scm index 319f63f9d2..0f766e7850 100644 --- a/gnu/packages/racket.scm +++ b/gnu/packages/racket.scm @@ -211,7 +211,8 @@ (define %racket-origin (sha256 (base32 "0f9zyhdvbh4xsndrqjzl85j5ziz0rmqi676g9s1lw3h3skq2636h")) (file-name (git-file-name "racket" %racket-version)) - (patches (search-patches "racket-rktio-bin-sh.patch")) + (patches (search-patches "racket-chez-scheme-bin-sh.patch" + "racket-rktio-bin-sh.patch")) (modules '((guix build utils))) (snippet #~(begin -- 2.32.0