guix/gnu/packages/patches/racket-chez-scheme-bin-sh.patch
Philip McGrath b965780334
gnu: zuo: Update to 1.9.
Zuo now has tagged releases independent of the Racket release cycle.

* gnu/packages/patches/racket-zuo-bin-sh.patch: Move to ...
* gnu/packages/patches/zuo-bin-sh.patch: ... this file, and refresh it.
* gnu/local.mk (dist_patch_DATA): Update accordingly.
* gnu/packages/racket/scm (%racket-origin)[patches]: Likewise.
* gnu/packages/patches/racket-chez-scheme-bin-sh.patch: Refresh patch.
* gnu/packages/patches/racket-rktio-bin-sh.patch: Likewise.
* gnu/packages/racket/scm (%zuo-version): Move to ...
(zuo)[version]: ... this field, and update to 1.9.
[source]: Change to the repository where Zuo releases are tagged.
[arguments]: Stop supplying '#:phases'.

Change-Id: Ia82c0f7a8e4696ae08e30965e3f4ec85673b86e5
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-04-11 12:44:59 +02:00

81 lines
2.4 KiB
Diff

From 5398e6d3305def343a009aba7c5f8915851c4115 Mon Sep 17 00:00:00 2001
From: Philip McGrath <philip@philipmcgrath.com>
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
<paths.h> 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 the patched Chez Scheme
or executables it builds in non-Guix envoronments.
This patch does not change the behavior of `s_system`, which relies
on `system` from the C library.
---
Notes:
See also chez-scheme-bin-sh.patch, racket-rktio-bin-sh.patch,
and zuo-bin-sh.patch.
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 90b087f125..284f063f8b 100644
--- a/racket/src/ChezScheme/c/prim5.c
+++ b/racket/src/ChezScheme/c/prim5.c
@@ -27,6 +27,12 @@
#include <sys/resource.h>
#endif
+/* BEGIN PATCH for Guix */
+#ifndef WIN32
+# include <paths.h>
+#endif
+/* END PATCH for Guix */
+
/* locally defined functions */
static INT s_errno(void);
static IBOOL s_addr_in_heap(uptr x);
@@ -875,6 +881,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)) {
@@ -911,7 +928,9 @@ static ptr s_process(char *s, IBOOL stderrp) {
}
}
#endif /* __GNU__ Hurd */
- 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: 78fef00d4d16a79fdf6ab31924b3a80cadf4b368
--
2.41.0