Blame SOURCES/ksh-20120801-crash.patch

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