all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
blob 69aca3b48352ef478b39aeb9aa6b799d42b2a6fe 2168 bytes (raw)
name: gnu/packages/patches/racket-chez-scheme-bin-sh.patch 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
 
From 988eea0a875d570d8ec155cb0925b4586d36e8d7 Mon Sep 17 00:00:00 2001
From: Philip McGrath <philip@philipmcgrath.com>
Date: Thu, 19 May 2022 13:41:56 -0400
Subject: [PATCH] Chez Scheme: patch s_process for "/bin/sh" on Guix

This patch reuses the C preprocessor macro `GUIX_RKTIO_BIN_SH`
from a previous patch.

If:

    1. The `GUIX_RKTIO_BIN_SH` macro is defined; and

    2. The path specified by `GUIX_RKTIO_BIN_SH` exists;

then `s_process` will call `execl` with the file specified by
`GUIX_RKTIO_BIN_SH` instead of "/bin/sh".

This patch does not change the behavior of `s_system`, which relies
on `system` from the C library.
---
 racket/src/ChezScheme/c/prim5.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/racket/src/ChezScheme/c/prim5.c b/racket/src/ChezScheme/c/prim5.c
index 82bbf8d687..307c8673a1 100644
--- a/racket/src/ChezScheme/c/prim5.c
+++ b/racket/src/ChezScheme/c/prim5.c
@@ -861,6 +861,22 @@ 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(GUIX_RKTIO_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: */
+    struct stat guix_stat_buf;
+    char *guix_sh =
+      (0 == stat(GUIX_AS_a_STR(GUIX_RKTIO_BIN_SH), &guix_stat_buf))
+      ? GUIX_AS_a_STR(GUIX_RKTIO_BIN_SH)
+      : "/bin/sh";
+# undef GUIX_AS_a_STR
+# undef GUIX_AS_a_STR_HELPER
+#else /* GUIX_RKTIO_BIN_SH */
+    char *guix_sh = "/bin/sh";
+#endif
+    /* END PATCH for Guix */
 
     if (pipe(tofds)) S_error("process","cannot open pipes");
     if (pipe(fromfds)) {
@@ -897,7 +913,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: 87eee6e2adb8c6bc11e60619c706fa6295096085
-- 
2.32.0


debug log:

solving 69aca3b483 ...
found 69aca3b483 in https://yhetil.org/guix/5e784e0d35bf5b342bd7df77c4fa137deb942e47.1660215295.git.philip@philipmcgrath.com/ ||
	https://yhetil.org/guix/0d47e0372925c83fb72ff37c0f00c8196327c636.1659936550.git.philip@philipmcgrath.com/
found df2eb671b3 in https://yhetil.org/guix/5e5e8f491c7cbee3ef7a21437a52675dd47d186e.1659936550.git.philip@philipmcgrath.com/ ||
	https://yhetil.org/guix/86c1205b1144c03620cce866e7d22c67d1e9c47d.1660215295.git.philip@philipmcgrath.com/

applying [1/2] https://yhetil.org/guix/5e5e8f491c7cbee3ef7a21437a52675dd47d186e.1659936550.git.philip@philipmcgrath.com/
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..df2eb671b3

3:35: trailing whitespace.
 
3:54: trailing whitespace.
 
3:70: trailing whitespace.
-- 
Checking patch gnu/packages/patches/racket-chez-scheme-bin-sh.patch...
3:72: new blank line at EOF.
+
Applied patch gnu/packages/patches/racket-chez-scheme-bin-sh.patch cleanly.
warning: 4 lines add whitespace errors.

skipping https://yhetil.org/guix/86c1205b1144c03620cce866e7d22c67d1e9c47d.1660215295.git.philip@philipmcgrath.com/ for df2eb671b3
index at:
100644 df2eb671b3b46def1df5cac0be5fd883ebcd4cc1	gnu/packages/patches/racket-chez-scheme-bin-sh.patch

applying [2/2] https://yhetil.org/guix/5e784e0d35bf5b342bd7df77c4fa137deb942e47.1660215295.git.philip@philipmcgrath.com/
diff --git a/gnu/packages/patches/racket-chez-scheme-bin-sh.patch b/gnu/packages/patches/racket-chez-scheme-bin-sh.patch
index df2eb671b3..69aca3b483 100644

Checking patch gnu/packages/patches/racket-chez-scheme-bin-sh.patch...
Applied patch gnu/packages/patches/racket-chez-scheme-bin-sh.patch cleanly.

skipping https://yhetil.org/guix/0d47e0372925c83fb72ff37c0f00c8196327c636.1659936550.git.philip@philipmcgrath.com/ for 69aca3b483
index at:
100644 69aca3b48352ef478b39aeb9aa6b799d42b2a6fe	gnu/packages/patches/racket-chez-scheme-bin-sh.patch

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.