2024-04-01 02:51:09 -04:00
|
|
|
From b8428ad25b437acf4bd8210b14db207b71fe44c3 Mon Sep 17 00:00:00 2001
|
2022-08-27 14:55:46 -04:00
|
|
|
From: Philip McGrath <philip@philipmcgrath.com>
|
2024-04-01 02:51:09 -04:00
|
|
|
Date: Wed, 24 Aug 2022 19:55:14 -0400
|
2022-08-27 14:55:46 -04:00
|
|
|
Subject: [PATCH] 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
|
2024-04-01 02:51:09 -04:00
|
|
|
against obscure errors if attempting to use the patched Chez Scheme
|
|
|
|
or executables it builds in non-Guix envoronments.
|
2022-08-27 14:55:46 -04:00
|
|
|
|
|
|
|
This patch does not change the behavior of `s_system`, which relies
|
|
|
|
on `system` from the C library.
|
|
|
|
---
|
2024-04-01 02:51:09 -04:00
|
|
|
|
|
|
|
Notes:
|
|
|
|
See also racket-chez-scheme-bin-sh.patch, racket-rktio-bin-sh.patch,
|
|
|
|
and zuo-bin-sh.patch.
|
|
|
|
|
2022-08-27 14:55:46 -04:00
|
|
|
c/prim5.c | 21 ++++++++++++++++++++-
|
|
|
|
1 file changed, 20 insertions(+), 1 deletion(-)
|
|
|
|
|
|
|
|
diff --git a/c/prim5.c b/c/prim5.c
|
2024-04-01 02:51:09 -04:00
|
|
|
index 90b087f1..284f063f 100644
|
2022-08-27 14:55:46 -04:00
|
|
|
--- a/c/prim5.c
|
|
|
|
+++ b/c/prim5.c
|
2024-04-01 02:51:09 -04:00
|
|
|
@@ -27,6 +27,12 @@
|
|
|
|
#include <sys/resource.h>
|
|
|
|
#endif
|
2022-08-27 14:55:46 -04:00
|
|
|
|
|
|
|
+/* BEGIN PATCH for Guix */
|
|
|
|
+#ifndef WIN32
|
|
|
|
+# include <paths.h>
|
|
|
|
+#endif
|
|
|
|
+/* END PATCH for Guix */
|
|
|
|
+
|
|
|
|
/* locally defined functions */
|
|
|
|
static INT s_errno(void);
|
2024-04-01 02:51:09 -04:00
|
|
|
static IBOOL s_addr_in_heap(uptr x);
|
|
|
|
@@ -875,6 +881,17 @@ static ptr s_process(char *s, IBOOL stderrp) {
|
2022-08-27 14:55:46 -04:00
|
|
|
|
|
|
|
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)) {
|
2024-04-01 02:51:09 -04:00
|
|
|
@@ -911,7 +928,9 @@ static ptr s_process(char *s, IBOOL stderrp) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif /* __GNU__ Hurd */
|
2022-08-27 14:55:46 -04:00
|
|
|
- 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 {
|
|
|
|
|
2024-04-01 02:51:09 -04:00
|
|
|
base-commit: 253230f7dfbb4fe777277d6bbf93f39f9567f086
|
2022-08-27 14:55:46 -04:00
|
|
|
--
|
2024-04-01 02:51:09 -04:00
|
|
|
2.41.0
|
2022-08-27 14:55:46 -04:00
|
|
|
|