diff -up ksh-20100202/src/cmd/ksh93/sh/jobs.c.pipefail ksh-20100202/src/cmd/ksh93/sh/jobs.c --- ksh-20100202/src/cmd/ksh93/sh/jobs.c.pipefail 2011-03-14 13:41:39.999572692 +0100 +++ ksh-20100202/src/cmd/ksh93/sh/jobs.c 2011-03-14 13:41:40.034572692 +0100 @@ -1429,7 +1429,7 @@ int job_wait(register pid_t pid) } } px = job_unpost(pw,1); - if(!px || !sh_isoption(SH_PIPEFAIL) || !job.waitall) + if(!px || !sh_isoption(SH_PIPEFAIL) && !job.waitall) break; pw = px; continue; diff -up ksh-20100202/src/cmd/ksh93/tests/basic.sh.pipefail ksh-20100202/src/cmd/ksh93/tests/basic.sh --- ksh-20100202/src/cmd/ksh93/tests/basic.sh.pipefail 2011-03-14 13:42:13.813572689 +0100 +++ ksh-20100202/src/cmd/ksh93/tests/basic.sh 2011-03-14 13:43:23.384572673 +0100 @@ -465,16 +465,16 @@ got=$( ( $SHELL -c 'trap : DEBUG; x=( $foo); exit 0') 2> /dev/null || err_exit 'trap DEBUG fails' -true=$(whence -p true) +bintrue=$(whence -p true) set -o pipefail float start=$SECONDS end for ((i=0; i < 2; i++)) do print foo sleep 1.5 -done | { read; $true; end=$SECONDS ;} +done | { read; $bintrue; end=$SECONDS ;} (( (SECONDS-start) < 1 )) && err_exit "pipefail not waiting for pipe to finish" set +o pipefail -(( (SECONDS-start) > 2 )) && err_exit "pipefail causing /bin/true to wait for other end of pipe" +(( (SECONDS-end) > 2 )) && err_exit "pipefail causing $bintrue to wait for other end of pipe" { env A__z=C+SHLVL $SHELL -c : ;} 2> /dev/null || err_exit "SHLVL with wrong attribute fails"