From 532276a537fbfc08c946c9f808f1b0bb54e16523 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= <joerg@thalheim.io>
Date: Sat, 24 Apr 2021 10:11:40 +0200
Subject: [PATCH 1/5] No impure bin sh

default_shell is used to populuate default shell used to execute jobs.
Unless SHELL is set to a different value this would be /bin/sh.
Our stdenv provides sh in form of bash anyway. Having this value not
hard-coded has some advantages:

- It would ensure that on all systems it uses sh from its PATH rather
  than /bin/sh, which helps as different systems might have different
  shells there (bash vs. dash)
- In the past I had issues with LD_PRELOAD with BEAR, where /bin/sh
  used a different glibc than BEAR which came from my development shell.

Co-authored-by: Michael Daniels <mdaniels5757@gmail.com>
---
 src/job.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/job.c b/src/job.c
index ea885614..1f26e0e8 100644
--- a/src/job.c
+++ b/src/job.c
@@ -76,7 +76,7 @@ char * vms_strsignal (int status);
 
 #else
 
-const char *default_shell = "/bin/sh";
+const char *default_shell = "sh";
 int batch_mode_shell = 0;
 
 #endif
@@ -2470,8 +2470,8 @@ child_execute_job (struct childbase *child, int good_stdin, char **argv)
       nargv[1] = cmd;
       memcpy (&nargv[2], &argv[1], sizeof (char *) * l);
 
-      while ((r = posix_spawn (&pid, nargv[0], &fa, &attr, nargv,
-                               child->environment)) == EINTR)
+      while ((r = posix_spawnp (&pid, nargv[0], &fa, &attr, nargv,
+                                child->environment)) == EINTR)
         ;
 
       free (nargv);
-- 
2.51.2

