Blame SOURCES/ksh-20120801-crash.patch

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