Blame SOURCES/ksh-20120801-crash.patch

dc1902
diff -up ksh-20120801/src/cmd/ksh93/include/jobs.h.crash ksh-20120801/src/cmd/ksh93/include/jobs.h
dc1902
--- ksh-20120801/src/cmd/ksh93/include/jobs.h.crash	2014-07-22 11:48:57.205062905 +0200
dc1902
+++ ksh-20120801/src/cmd/ksh93/include/jobs.h	2014-07-22 11:48:57.243062711 +0200
dc1902
@@ -118,6 +118,7 @@ struct jobs
dc1902
 	char		jobcontrol;	/* turned on for real job control */
dc1902
 	char		waitsafe;	/* wait will not block */
dc1902
 	char		waitall;	/* wait for all jobs in pipe */
dc1902
+	char		hack1_waitall;
dc1902
 	char		toclear;	/* job table needs clearing */
dc1902
 	unsigned char	*freejobs;	/* free jobs numbers */
dc1902
 #if SHOPT_COSHELL
dc1902
diff -up ksh-20120801/src/cmd/ksh93/sh/jobs.c.crash ksh-20120801/src/cmd/ksh93/sh/jobs.c
dc1902
--- ksh-20120801/src/cmd/ksh93/sh/jobs.c.crash	2014-07-22 11:48:57.190062982 +0200
dc1902
+++ ksh-20120801/src/cmd/ksh93/sh/jobs.c	2014-07-22 11:48:57.243062711 +0200
dc1902
@@ -1957,6 +1957,7 @@ again:
dc1902
 	{
dc1902
 		count = bp->count;
dc1902
 		jp = bp->list;
dc1902
+		jpold = 0;
dc1902
 		goto again;
dc1902
 	}
dc1902
 	if(jp)
dc1902
diff -up ksh-20120801/src/cmd/ksh93/sh/subshell.c.crash ksh-20120801/src/cmd/ksh93/sh/subshell.c
dc1902
--- ksh-20120801/src/cmd/ksh93/sh/subshell.c.crash	2014-07-22 11:48:57.234062758 +0200
dc1902
+++ ksh-20120801/src/cmd/ksh93/sh/subshell.c	2014-07-22 11:54:04.164491483 +0200
dc1902
@@ -492,6 +492,7 @@ Sfio_t *sh_subshell(Shell_t *shp,Shnode_
dc1902
 	struct sh_scoped savst;
dc1902
 	struct dolnod   *argsav=0;
dc1902
 	int argcnt;
dc1902
+        int pipefail = 0;
dc1902
 	memset((char*)sp, 0, sizeof(*sp));
dc1902
 	sfsync(shp->outpool);
dc1902
 	sh_sigcheck(shp);
dc1902
@@ -541,7 +542,10 @@ Sfio_t *sh_subshell(Shell_t *shp,Shnode_
dc1902
 	sp->comsub = shp->comsub;
dc1902
 	shp->subshare = comsub==2 ||  (comsub==1 && sh_isoption(SH_SUBSHARE));
dc1902
 	if(comsub)
dc1902
+	{
dc1902
 		shp->comsub = comsub;
dc1902
+		job.hack1_waitall=(comsub==1);
dc1902
+	}
dc1902
 	sp->shpwdfd=-1;
dc1902
 	if(!comsub || !shp->subshare)
dc1902
 	{
dc1902
@@ -648,6 +652,7 @@ Sfio_t *sh_subshell(Shell_t *shp,Shnode_
dc1902
 		}
dc1902
 		else
dc1902
 		{
dc1902
+			job.hack1_waitall=0;
dc1902
 			if(comsub!=1 && shp->spid)
dc1902
 			{
dc1902
 				job_wait(shp->spid);
dc1902
diff -up ksh-20120801/src/cmd/ksh93/sh/xec.c.crash ksh-20120801/src/cmd/ksh93/sh/xec.c
dc1902
--- ksh-20120801/src/cmd/ksh93/sh/xec.c.crash	2014-07-22 11:48:57.228062787 +0200
dc1902
+++ ksh-20120801/src/cmd/ksh93/sh/xec.c	2014-07-22 11:48:57.245062700 +0200
dc1902
@@ -2125,7 +2125,7 @@ int sh_exec(register const Shnode_t *t,
dc1902
 				memset(exitval,0,job.waitall*sizeof(int));
dc1902
 			}
dc1902
 			else
dc1902
-				job.waitall |= !pipejob && sh_isstate(SH_MONITOR);
dc1902
+				job.waitall |= job.hack1_waitall || !pipejob && sh_isstate(SH_MONITOR);
dc1902
 			job_lock();
dc1902
 			nlock++;
dc1902
 			do