openbsd.rc: work around rc_bg bug when /bin/sh is bash (#384012)

authored by John Ericson and committed by GitHub 39fa23b4 ef67097b

+23 -1
+19
pkgs/os-specific/bsd/openbsd/pkgs/rc/binsh-is-bash.patch
···
··· 1 + When /bin/sh is bash, this code doesn't work right - bash has a "tail call" 2 + optimization where the last command in a finite script will be run as if with 3 + exec instead of forking a new shell. rc here expects `pkill -P $$` (kill all 4 + processes with parent pid == shell) to effectively background a process, but 5 + instead it kills it! 6 + 7 + diff --git a/etc/rc.d/rc.subr b/etc/rc.d/rc.subr 8 + index 1f872f0ebc8..0c32b00e2ef 100644 9 + --- a/etc/rc.d/rc.subr 10 + +++ b/etc/rc.d/rc.subr 11 + @@ -178,7 +178,7 @@ rc_exec() { 12 + ${daemon_execdir:+cd ${daemon_execdir} && } \ 13 + $@ \ 14 + ${daemon_logger:+ 2>&1 | 15 + - logger -isp ${daemon_logger} -t ${_name}}" 16 + + logger -isp ${daemon_logger} -t ${_name}}; exit" 17 + } 18 + 19 + rc_start() {
+4 -1
pkgs/os-specific/bsd/openbsd/pkgs/rc/package.nix
··· 5 pname = "rc"; 6 path = "etc"; 7 8 - patches = [ ./boot-phases.patch ]; 9 10 buildPhase = ":"; 11
··· 5 pname = "rc"; 6 path = "etc"; 7 8 + patches = [ 9 + ./boot-phases.patch 10 + ./binsh-is-bash.patch 11 + ]; 12 13 buildPhase = ":"; 14