components/ksh93/patches/CR7178717.patch
author Nobutomo Nakano <nobutomo.nakano@oracle.com>
Mon, 16 Jul 2012 11:15:50 -0700
changeset 917 c2d902bbacc9
permissions -rw-r--r--
7178717 ksh93 may report wrong exit status for the last component of pipeline
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
917
c2d902bbacc9 7178717 ksh93 may report wrong exit status for the last component of pipeline
Nobutomo Nakano <nobutomo.nakano@oracle.com>
parents:
diff changeset
     1
*** INIT.2011-02-08/src/cmd/ksh93/sh/jobs.c	Tue Jul 10 17:37:30 2012
c2d902bbacc9 7178717 ksh93 may report wrong exit status for the last component of pipeline
Nobutomo Nakano <nobutomo.nakano@oracle.com>
parents:
diff changeset
     2
--- ./jobs.c	Tue Jul 10 18:59:39 2012
c2d902bbacc9 7178717 ksh93 may report wrong exit status for the last component of pipeline
Nobutomo Nakano <nobutomo.nakano@oracle.com>
parents:
diff changeset
     3
***************
c2d902bbacc9 7178717 ksh93 may report wrong exit status for the last component of pipeline
Nobutomo Nakano <nobutomo.nakano@oracle.com>
parents:
diff changeset
     4
*** 1969,1985 ****
c2d902bbacc9 7178717 ksh93 may report wrong exit status for the last component of pipeline
Nobutomo Nakano <nobutomo.nakano@oracle.com>
parents:
diff changeset
     5
  	register struct back_save *bp = (struct back_save*)ptr;
c2d902bbacc9 7178717 ksh93 may report wrong exit status for the last component of pipeline
Nobutomo Nakano <nobutomo.nakano@oracle.com>
parents:
diff changeset
     6
  	register struct process *pw, *px, *pwnext;
c2d902bbacc9 7178717 ksh93 may report wrong exit status for the last component of pipeline
Nobutomo Nakano <nobutomo.nakano@oracle.com>
parents:
diff changeset
     7
  	struct jobsave *jpnext;
c2d902bbacc9 7178717 ksh93 may report wrong exit status for the last component of pipeline
Nobutomo Nakano <nobutomo.nakano@oracle.com>
parents:
diff changeset
     8
  	job_lock();
c2d902bbacc9 7178717 ksh93 may report wrong exit status for the last component of pipeline
Nobutomo Nakano <nobutomo.nakano@oracle.com>
parents:
diff changeset
     9
! 	for(jp=bck.list; jp; jp=jpnext)
c2d902bbacc9 7178717 ksh93 may report wrong exit status for the last component of pipeline
Nobutomo Nakano <nobutomo.nakano@oracle.com>
parents:
diff changeset
    10
! 	{
c2d902bbacc9 7178717 ksh93 may report wrong exit status for the last component of pipeline
Nobutomo Nakano <nobutomo.nakano@oracle.com>
parents:
diff changeset
    11
  		jpnext = jp->next;
c2d902bbacc9 7178717 ksh93 may report wrong exit status for the last component of pipeline
Nobutomo Nakano <nobutomo.nakano@oracle.com>
parents:
diff changeset
    12
! 		if(jp->curenv != sh.curenv || jp->pid==sh.spid)
c2d902bbacc9 7178717 ksh93 may report wrong exit status for the last component of pipeline
Nobutomo Nakano <nobutomo.nakano@oracle.com>
parents:
diff changeset
    13
! 		{
c2d902bbacc9 7178717 ksh93 may report wrong exit status for the last component of pipeline
Nobutomo Nakano <nobutomo.nakano@oracle.com>
parents:
diff changeset
    14
! 			jp->next = bp->list;
c2d902bbacc9 7178717 ksh93 may report wrong exit status for the last component of pipeline
Nobutomo Nakano <nobutomo.nakano@oracle.com>
parents:
diff changeset
    15
! 			bp->list = jp;
c2d902bbacc9 7178717 ksh93 may report wrong exit status for the last component of pipeline
Nobutomo Nakano <nobutomo.nakano@oracle.com>
parents:
diff changeset
    16
! 			bp->count++;
c2d902bbacc9 7178717 ksh93 may report wrong exit status for the last component of pipeline
Nobutomo Nakano <nobutomo.nakano@oracle.com>
parents:
diff changeset
    17
! 		}
c2d902bbacc9 7178717 ksh93 may report wrong exit status for the last component of pipeline
Nobutomo Nakano <nobutomo.nakano@oracle.com>
parents:
diff changeset
    18
! 		else
c2d902bbacc9 7178717 ksh93 may report wrong exit status for the last component of pipeline
Nobutomo Nakano <nobutomo.nakano@oracle.com>
parents:
diff changeset
    19
  			job_chksave(jp->pid);
c2d902bbacc9 7178717 ksh93 may report wrong exit status for the last component of pipeline
Nobutomo Nakano <nobutomo.nakano@oracle.com>
parents:
diff changeset
    20
  	}
c2d902bbacc9 7178717 ksh93 may report wrong exit status for the last component of pipeline
Nobutomo Nakano <nobutomo.nakano@oracle.com>
parents:
diff changeset
    21
  	for(pw=job.pwlist; pw; pw=pwnext)
c2d902bbacc9 7178717 ksh93 may report wrong exit status for the last component of pipeline
Nobutomo Nakano <nobutomo.nakano@oracle.com>
parents:
diff changeset
    22
--- 1969,2000 ----
c2d902bbacc9 7178717 ksh93 may report wrong exit status for the last component of pipeline
Nobutomo Nakano <nobutomo.nakano@oracle.com>
parents:
diff changeset
    23
  	register struct back_save *bp = (struct back_save*)ptr;
c2d902bbacc9 7178717 ksh93 may report wrong exit status for the last component of pipeline
Nobutomo Nakano <nobutomo.nakano@oracle.com>
parents:
diff changeset
    24
  	register struct process *pw, *px, *pwnext;
c2d902bbacc9 7178717 ksh93 may report wrong exit status for the last component of pipeline
Nobutomo Nakano <nobutomo.nakano@oracle.com>
parents:
diff changeset
    25
  	struct jobsave *jpnext;
c2d902bbacc9 7178717 ksh93 may report wrong exit status for the last component of pipeline
Nobutomo Nakano <nobutomo.nakano@oracle.com>
parents:
diff changeset
    26
+ 
c2d902bbacc9 7178717 ksh93 may report wrong exit status for the last component of pipeline
Nobutomo Nakano <nobutomo.nakano@oracle.com>
parents:
diff changeset
    27
  	job_lock();
c2d902bbacc9 7178717 ksh93 may report wrong exit status for the last component of pipeline
Nobutomo Nakano <nobutomo.nakano@oracle.com>
parents:
diff changeset
    28
! 	for(jp = bck.list; jp != NULL; jp = jpnext) {
c2d902bbacc9 7178717 ksh93 may report wrong exit status for the last component of pipeline
Nobutomo Nakano <nobutomo.nakano@oracle.com>
parents:
diff changeset
    29
  		jpnext = jp->next;
c2d902bbacc9 7178717 ksh93 may report wrong exit status for the last component of pipeline
Nobutomo Nakano <nobutomo.nakano@oracle.com>
parents:
diff changeset
    30
! 		if (jp->curenv != sh.curenv || jp->pid == sh.spid) {
c2d902bbacc9 7178717 ksh93 may report wrong exit status for the last component of pipeline
Nobutomo Nakano <nobutomo.nakano@oracle.com>
parents:
diff changeset
    31
! 			struct jobsave *jp2, *jp2next;
c2d902bbacc9 7178717 ksh93 may report wrong exit status for the last component of pipeline
Nobutomo Nakano <nobutomo.nakano@oracle.com>
parents:
diff changeset
    32
! 			/*
c2d902bbacc9 7178717 ksh93 may report wrong exit status for the last component of pipeline
Nobutomo Nakano <nobutomo.nakano@oracle.com>
parents:
diff changeset
    33
! 			 * We may have same pid in both saved list and current
c2d902bbacc9 7178717 ksh93 may report wrong exit status for the last component of pipeline
Nobutomo Nakano <nobutomo.nakano@oracle.com>
parents:
diff changeset
    34
! 			 * list. We discard the old jobsave by copying the new
c2d902bbacc9 7178717 ksh93 may report wrong exit status for the last component of pipeline
Nobutomo Nakano <nobutomo.nakano@oracle.com>
parents:
diff changeset
    35
! 			 * one.
c2d902bbacc9 7178717 ksh93 may report wrong exit status for the last component of pipeline
Nobutomo Nakano <nobutomo.nakano@oracle.com>
parents:
diff changeset
    36
! 			 */
c2d902bbacc9 7178717 ksh93 may report wrong exit status for the last component of pipeline
Nobutomo Nakano <nobutomo.nakano@oracle.com>
parents:
diff changeset
    37
! 			for (jp2 = bp->list; jp2 != NULL; jp2 = jp2->next) {
c2d902bbacc9 7178717 ksh93 may report wrong exit status for the last component of pipeline
Nobutomo Nakano <nobutomo.nakano@oracle.com>
parents:
diff changeset
    38
! 				if (jp->pid == jp2->pid)
c2d902bbacc9 7178717 ksh93 may report wrong exit status for the last component of pipeline
Nobutomo Nakano <nobutomo.nakano@oracle.com>
parents:
diff changeset
    39
! 					break;
c2d902bbacc9 7178717 ksh93 may report wrong exit status for the last component of pipeline
Nobutomo Nakano <nobutomo.nakano@oracle.com>
parents:
diff changeset
    40
! 			}
c2d902bbacc9 7178717 ksh93 may report wrong exit status for the last component of pipeline
Nobutomo Nakano <nobutomo.nakano@oracle.com>
parents:
diff changeset
    41
! 			if (jp2 != NULL) {
c2d902bbacc9 7178717 ksh93 may report wrong exit status for the last component of pipeline
Nobutomo Nakano <nobutomo.nakano@oracle.com>
parents:
diff changeset
    42
! 				jp2next = jp2->next;
c2d902bbacc9 7178717 ksh93 may report wrong exit status for the last component of pipeline
Nobutomo Nakano <nobutomo.nakano@oracle.com>
parents:
diff changeset
    43
! 				*jp2 = *jp;
c2d902bbacc9 7178717 ksh93 may report wrong exit status for the last component of pipeline
Nobutomo Nakano <nobutomo.nakano@oracle.com>
parents:
diff changeset
    44
! 				jp2->next = jp2next;
c2d902bbacc9 7178717 ksh93 may report wrong exit status for the last component of pipeline
Nobutomo Nakano <nobutomo.nakano@oracle.com>
parents:
diff changeset
    45
! 				job_chksave(jp2->pid);
c2d902bbacc9 7178717 ksh93 may report wrong exit status for the last component of pipeline
Nobutomo Nakano <nobutomo.nakano@oracle.com>
parents:
diff changeset
    46
! 			} else {
c2d902bbacc9 7178717 ksh93 may report wrong exit status for the last component of pipeline
Nobutomo Nakano <nobutomo.nakano@oracle.com>
parents:
diff changeset
    47
! 				jp->next = bp->list;
c2d902bbacc9 7178717 ksh93 may report wrong exit status for the last component of pipeline
Nobutomo Nakano <nobutomo.nakano@oracle.com>
parents:
diff changeset
    48
! 				bp->list = jp;
c2d902bbacc9 7178717 ksh93 may report wrong exit status for the last component of pipeline
Nobutomo Nakano <nobutomo.nakano@oracle.com>
parents:
diff changeset
    49
! 				bp->count++;
c2d902bbacc9 7178717 ksh93 may report wrong exit status for the last component of pipeline
Nobutomo Nakano <nobutomo.nakano@oracle.com>
parents:
diff changeset
    50
! 			}
c2d902bbacc9 7178717 ksh93 may report wrong exit status for the last component of pipeline
Nobutomo Nakano <nobutomo.nakano@oracle.com>
parents:
diff changeset
    51
! 		} else
c2d902bbacc9 7178717 ksh93 may report wrong exit status for the last component of pipeline
Nobutomo Nakano <nobutomo.nakano@oracle.com>
parents:
diff changeset
    52
  			job_chksave(jp->pid);
c2d902bbacc9 7178717 ksh93 may report wrong exit status for the last component of pipeline
Nobutomo Nakano <nobutomo.nakano@oracle.com>
parents:
diff changeset
    53
  	}
c2d902bbacc9 7178717 ksh93 may report wrong exit status for the last component of pipeline
Nobutomo Nakano <nobutomo.nakano@oracle.com>
parents:
diff changeset
    54
  	for(pw=job.pwlist; pw; pw=pwnext)