Leah Neukirchen <leah@xxxxxxxx> wrote: > Hi, > > as of dash 0.5.10, this script waits for the sleep to terminate before > executing the last line, which no other /bin/sh does. > dash 0.5.9.1 worked fine. > > > #!/bin/sh > sleep 3 & > echo first in main shell > ( echo in subshell; ) > echo back to main shell > > > Found by users of the Void Linux project: > https://github.com/voidlinux/void-packages/issues/14123 Thanks for the report! This patch should fix the problem: ---8<--- Subject: jobs - Do not block when waiting on SIGCHLD Because of the nature of SIGCHLD, the process may have already been waited on and therefore we must be prepared for the case that wait may block. So ensure that it doesn't by using WNOHANG. Fixes: 03876c0743a5 ("eval: Reap zombies after built-in...") Signed-off-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> diff --git a/src/jobs.c b/src/jobs.c index 1a97c54..6dc555f 100644 --- a/src/jobs.c +++ b/src/jobs.c @@ -975,8 +975,8 @@ waitforjob(struct job *jp) int st; TRACE(("waitforjob(%%%d) called\n", jp ? jobno(jp) : 0)); - while ((jp && jp->state == JOBRUNNING) || gotsigchld) - dowait(DOWAIT_BLOCK, jp); + while (jp ? jp->state == JOBRUNNING : gotsigchld) + dowait(jp ? DOWAIT_BLOCK : DOWAIT_NORMAL, jp); if (!jp) return exitstatus; st = getstatus(jp); -- Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt -- To unsubscribe from this list: send the line "unsubscribe dash" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html