Blame SOURCES/ksh-20120801-crash.patch

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