all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
blob 392ea0512973fc33bca39cd764057b7d181ec54a 2385 bytes (raw)
name: gnu/packages/patches/racket-zuo-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
67
68
69
70
71
72
 
From 4888106cdfd80d1af925e5a485a2812d35a83b46 Mon Sep 17 00:00:00 2001
From: Philip McGrath <philip@philipmcgrath.com>
Date: Mon, 11 Apr 2022 20:43:18 -0400
Subject: [PATCH] Zuo: patch zuo_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. `zuo_process` is called with the exact path "/bin/sh"; and

    3. The path specified by `GUIX_RKTIO_BIN_SH` exists;

then `zuo_process` will execute the file specified by
`GUIX_RKTIO_BIN_SH` instead of "/bin/sh".
---
 racket/src/zuo/zuo.c | 27 +++++++++++++++++++++++++--
 1 file changed, 25 insertions(+), 2 deletions(-)

diff --git a/racket/src/zuo/zuo.c b/racket/src/zuo/zuo.c
index 17f161826d..10e7a2a297 100644
--- a/racket/src/zuo/zuo.c
+++ b/racket/src/zuo/zuo.c
@@ -5730,7 +5730,18 @@ static void zuo_pipe(zuo_raw_handle_t *_r, zuo_raw_handle_t *_w)
 zuo_t *zuo_process(zuo_t *command_and_args)
 {
   const char *who = "process";
-  zuo_t *command = _zuo_car(command_and_args);
+  /* BEGIN PATCH for Guix */
+  zuo_t *_guix_orig_command = _zuo_car(command_and_args);
+  zuo_t *command;
+#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: */
+  const char *guix_sh = GUIX_AS_a_STR(GUIX_RKTIO_BIN_SH);
+# undef GUIX_AS_a_STR
+# undef GUIX_AS_a_STR_HELPER
+#endif
+  /* END PATCH for Guix */
   zuo_t *args = _zuo_cdr(command_and_args), *rev_args = z.o_null;
   zuo_t *options = z.o_empty_hash, *opt;
   zuo_t *dir, *l, *p_handle, *result;
@@ -5741,7 +5752,19 @@ zuo_t *zuo_process(zuo_t *command_and_args)
   void *env;
   int as_child, exact_cmdline;
 
-  check_path_string(who, command);
+  /* BEGIN PATCH for Guix */
+  check_path_string(who, _guix_orig_command);
+#if defined(GUIX_RKTIO_BIN_SH)
+  command =
+    ((z.o_false == zuo_string_eql(_guix_orig_command, zuo_string("/bin/sh")))
+     || (z.o_false == zuo_stat(zuo_string(guix_sh), z.o_false, z.o_true)))
+    ? _guix_orig_command
+    : zuo_string(guix_sh);
+#else
+  command = _guix_orig_command;
+#endif
+  /* END PATCH for Guix */
+
   for (l = args; l->tag == zuo_pair_tag; l = _zuo_cdr(l)) {
     zuo_t *a = _zuo_car(l);
     if (a == z.o_null) {

base-commit: 87eee6e2adb8c6bc11e60619c706fa6295096085
-- 
2.32.0


debug log:

solving 392ea05129 ...
found 392ea05129 in https://yhetil.org/guix/285372112d70bcb4011d6c085592787df4f57d44.1660215295.git.philip@philipmcgrath.com/ ||
	https://yhetil.org/guix/0d47e0372925c83fb72ff37c0f00c8196327c636.1659936550.git.philip@philipmcgrath.com/

applying [1/1] https://yhetil.org/guix/285372112d70bcb4011d6c085592787df4f57d44.1660215295.git.philip@philipmcgrath.com/
diff --git a/gnu/packages/patches/racket-zuo-bin-sh.patch b/gnu/packages/patches/racket-zuo-bin-sh.patch
new file mode 100644
index 0000000000..392ea05129

1:56: trailing whitespace.
 
1:76: trailing whitespace.
-- 
Checking patch gnu/packages/patches/racket-zuo-bin-sh.patch...
1:78: new blank line at EOF.
+
Applied patch gnu/packages/patches/racket-zuo-bin-sh.patch cleanly.
warning: 3 lines add whitespace errors.

skipping https://yhetil.org/guix/0d47e0372925c83fb72ff37c0f00c8196327c636.1659936550.git.philip@philipmcgrath.com/ for 392ea05129
index at:
100644 392ea0512973fc33bca39cd764057b7d181ec54a	gnu/packages/patches/racket-zuo-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.