From 7d2bb8fdd9a96158437360a2de07cbcbe107fa79 Mon Sep 17 00:00:00 2001 From: Martijn Dekker Date: Sat, 9 Jan 2021 01:58:23 +0000 Subject: [PATCH] libast: fix exec fail on interactive (Solaris patch 315-26773587) This upstreams a Solaris patch: https://github.com/oracle/solaris-userland/blob/master/components/ksh93/patches/315-26773587.patch which ostensibly fixes this bug filed in Oracle's closed system: 26773587 interactive ksh exec failure in while read loop src/lib/libast/comp/spawnveg.c: - If posix_spawn(3) fails with an error other than EPERM, retry, but without attributes. --- src/lib/libast/comp/spawnveg.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib/libast/comp/spawnveg.c b/src/lib/libast/comp/spawnveg.c index 6117e3ad1..3634c0f55 100644 --- a/src/lib/libast/comp/spawnveg.c +++ b/src/lib/libast/comp/spawnveg.c @@ -63,7 +63,10 @@ spawnveg(const char* path, char* const argv[], char* const envv[], pid_t pgid) goto bad; } if (err = posix_spawn(&pid, path, NiL, &attr, argv, envv ? envv : environ)) - goto bad; + { + if ((err != EPERM) || (err = posix_spawn(&pid, path, NiL, NiL, argv, envv ? envv : environ))) + goto bad; + } posix_spawnattr_destroy(&attr); #if _lib_posix_spawn < 2 if (waitpid(pid, &err, WNOHANG|WNOWAIT) == pid && EXIT_STATUS(err) == 127)