7178717 ksh93 may report wrong exit status for the last component of pipeline
authorNobutomo Nakano <nobutomo.nakano@oracle.com>
Mon, 16 Jul 2012 11:15:50 -0700
changeset 917 c2d902bbacc9
parent 916 fb0329e47bf5
child 918 35e4a56e4a26
7178717 ksh93 may report wrong exit status for the last component of pipeline
components/ksh93/Makefile
components/ksh93/patches/CR7178717.patch
--- a/components/ksh93/Makefile	Mon Jul 16 10:44:29 2012 -0700
+++ b/components/ksh93/Makefile	Mon Jul 16 11:15:50 2012 -0700
@@ -71,7 +71,7 @@
 					 CR7089799.patch CR6917338.patch \
 					 CR7019368.patch CR6729252.patch \
 					 MAP_TYPE_64_Bits.patch CR7167466.patch \
-					 CR7168611.patch
+					 CR7168611.patch CR7178717.patch
 
 # Fixup HOSTTYPE to match uname output and bits
 HOSTTYPE32=sol11.$(shell uname -p)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ksh93/patches/CR7178717.patch	Mon Jul 16 11:15:50 2012 -0700
@@ -0,0 +1,54 @@
+*** INIT.2011-02-08/src/cmd/ksh93/sh/jobs.c	Tue Jul 10 17:37:30 2012
+--- ./jobs.c	Tue Jul 10 18:59:39 2012
+***************
+*** 1969,1985 ****
+  	register struct back_save *bp = (struct back_save*)ptr;
+  	register struct process *pw, *px, *pwnext;
+  	struct jobsave *jpnext;
+  	job_lock();
+! 	for(jp=bck.list; jp; jp=jpnext)
+! 	{
+  		jpnext = jp->next;
+! 		if(jp->curenv != sh.curenv || jp->pid==sh.spid)
+! 		{
+! 			jp->next = bp->list;
+! 			bp->list = jp;
+! 			bp->count++;
+! 		}
+! 		else
+  			job_chksave(jp->pid);
+  	}
+  	for(pw=job.pwlist; pw; pw=pwnext)
+--- 1969,2000 ----
+  	register struct back_save *bp = (struct back_save*)ptr;
+  	register struct process *pw, *px, *pwnext;
+  	struct jobsave *jpnext;
++ 
+  	job_lock();
+! 	for(jp = bck.list; jp != NULL; jp = jpnext) {
+  		jpnext = jp->next;
+! 		if (jp->curenv != sh.curenv || jp->pid == sh.spid) {
+! 			struct jobsave *jp2, *jp2next;
+! 			/*
+! 			 * We may have same pid in both saved list and current
+! 			 * list. We discard the old jobsave by copying the new
+! 			 * one.
+! 			 */
+! 			for (jp2 = bp->list; jp2 != NULL; jp2 = jp2->next) {
+! 				if (jp->pid == jp2->pid)
+! 					break;
+! 			}
+! 			if (jp2 != NULL) {
+! 				jp2next = jp2->next;
+! 				*jp2 = *jp;
+! 				jp2->next = jp2next;
+! 				job_chksave(jp2->pid);
+! 			} else {
+! 				jp->next = bp->list;
+! 				bp->list = jp;
+! 				bp->count++;
+! 			}
+! 		} else
+  			job_chksave(jp->pid);
+  	}
+  	for(pw=job.pwlist; pw; pw=pwnext)