<!DOCTYPE html>
<html lang='en'>
<head>
<title>guix - Wojtek's customized Guix</title>
<meta name='generator' content='cgit v1.2.3'/>
<meta name='robots' content='noindex, nofollow'/>
<link rel='stylesheet' type='text/css' href='/cgit-static/cgit.css'/>
<link rel='stylesheet' type='text/css' href='/cgit-static/better-cgit-markdown-heading-color.css'/>
<link rel='shortcut icon' href='/cgit-static/favicon.ico'/>
<link rel='alternate' title='Atom feed' href='https://git.koszko.org/guix/atom/?h=koszko' type='application/atom+xml'/>
</head>
<body>
<div id='cgit'><table id='header'>
<tr>
<td class='logo' rowspan='2'><a href='/'><img src='https://git.koszko.org/cgit-static/cgit.png' alt='cgit logo'/></a></td>
<td class='main'><a href='/'>index</a> : <a href='/guix/'>guix</a></td><td class='form'><form method='get'>
<input type='hidden' name='id' value='b4af9220d0a4f5e1482d1364dbc00c57d23e80b6'/><select name='h' onchange='this.form.submit();'>
<option value='koszko' selected='selected'>koszko</option>
<option value='koszko-scripts'>koszko-scripts</option>
</select> <input type='submit' value='switch'/></form></td></tr>
<tr><td class='sub'>Wojtek's customized Guix</td><td class='sub right'>k's customized Guix</td><td class='sub right'></td></tr></table>
<table class='tabs'><tr><td>
<a class='active' href='/guix/about/'>about</a><a href='/guix/'>summary</a><a href='/guix/refs/?id=3d0cdf963820da665d71987c15cae6e503efc701'>refs</a><a href='/guix/log/'>log</a><a href='/guix/tree/?id=3d0cdf963820da665d71987c15cae6e503efc701'>tree</a><a href='/guix/commit/?id=3d0cdf963820da665d71987c15cae6e503efc701'>commit</a><a href='/guix/diff/?id=3d0cdf963820da665d71987c15cae6e503efc701'>diff</a></td><td class='form'><form class='right' method='get' action='/guix/log/'>
<input type='hidden' name='id' value='3d0cdf963820da665d71987c15cae6e503efc701'/><select name='qt'>
<option value='grep'>log msg</option>
<option value='author'>author</option>
<option value='committer'>committer</option>
<option value='range'>range</option>
</select>
<input class='txt' type='search' size='10' name='q' value=''/>
<input type='submit' value='search'/>
</form>
</td></tr></table>
<div class='content'><div id='summary'><pre>
From b8428ad25b437acf4bd8210b14db207b71fe44c3 Mon Sep 17 00:00:00 2001
From: Philip McGrath &lt;philip@philipmcgrath.com&gt;
Date: Wed, 24 Aug 2022 19:55:14 -0400
Subject: [PATCH] patch s_process for &quot;/bin/sh&quot; on Guix

If:

    1. The nonstandard but ubiquitous macro `_PATH_BSHELL` from
       &lt;paths.h&gt; 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 &quot;/bin/sh&quot;.

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 racket-chez-scheme-bin-sh.patch, racket-rktio-bin-sh.patch,
    and zuo-bin-sh.patch.

 c/prim5.c | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/c/prim5.c b/c/prim5.c
index 90b087f1..284f063f 100644
--- a/c/prim5.c
+++ b/c/prim5.c
@@ -27,6 +27,12 @@
 #include &lt;sys/resource.h&gt;
 #endif
 
+/* BEGIN PATCH for Guix */
+#ifndef WIN32
+# include &lt;paths.h&gt;
+#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, &amp;guix_stat_buf))
+      ? _PATH_BSHELL
+      : &quot;/bin/sh&quot;;
+#else /* _PATH_BSHELL */
+    char *guix_sh = &quot;/bin/sh&quot;;
+#endif
+    /* END PATCH for Guix */
 
     if (pipe(tofds)) S_error(&quot;process&quot;,&quot;cannot open pipes&quot;);
     if (pipe(fromfds)) {
@@ -911,7 +928,9 @@ static ptr s_process(char *s, IBOOL stderrp) {
           }
         }
 #endif /* __GNU__ Hurd */
-        execl(&quot;/bin/sh&quot;, &quot;/bin/sh&quot;, &quot;-c&quot;, s, NULL);
+        /* BEGIN PATCH for Guix */
+        execl(guix_sh, guix_sh, &quot;-c&quot;, s, NULL);
+        /* END PATCH for Guix */
         _exit(1) /* only if execl fails */;
         /*NOTREACHED*/
     } else {

base-commit: 253230f7dfbb4fe777277d6bbf93f39f9567f086
-- 
2.41.0

</pre>
</div></div> <!-- class=content -->
                         <div class=footer>generated by
                             <a href="https://git.zx2c4.com/cgit/about/">
                                 cgit
                             </a>
                         </div>
                        </div> <!-- id=cgit -->
</body>
</html>
