components/ksh93/patches/Bug15794787,15819673.patch
author Vladimir Marek <Vladimir.Marek@oracle.com>
Mon, 25 Nov 2013 17:42:18 +0100
branchs11u1-sru
changeset 2846 308d0c192664
parent 2544 50b56aff2479
permissions -rw-r--r--
17714341 /usr/bin/cd core dumps during string substitution

--- a/src/cmd/ksh93/sh/xec.c	Thu Nov 29 22:06:17 2012
+++ b/src/cmd/ksh93/sh/xec.c	Fri Nov 30 00:45:30 2012
@@ -540,8 +540,10 @@
 	static Sfio_t *io_save;
 	volatile int traceon=0, lineno=0;
 	int binscript=shp->binscript;
+	char comsub = shp->comsub;
 	io_save = iop; /* preserve correct value across longjmp */
 	shp->binscript = 0;
+	shp->comsub = 0;
 #define SH_TOPFUN	0x8000	/* this is a temporary tksh hack */
 	if (mode & SH_TOPFUN)
 	{
@@ -581,6 +583,7 @@
 	}
 	sh_popcontext(shp,&buff);
 	shp->binscript = binscript;
+	shp->comsub = comsub;
 	if(traceon)
 		sh_onoption(SH_XTRACE);
 	if(lineno)
@@ -3281,7 +3284,8 @@
 	struct funenv fun;
 	char *fname = nv_getval(SH_FUNNAMENOD);
 	struct Level	*lp =(struct Level*)(SH_LEVELNOD->nvfun);
-	int		level, pipepid=shp->pipepid;
+	int		level, pipepid=shp->pipepid, comsub=shp->comsub;
+	shp->comsub = 0;
 	shp->pipepid = 0;
 	sh_stats(STAT_FUNCT);
 	if(!lp->hdr.disc)
@@ -3323,6 +3327,7 @@
 	lp->maxlevel = level;
 	SH_LEVELNOD->nvalue.s = lp->maxlevel;
 	shp->last_root = nv_dict(DOTSHNOD);
+	shp->comsub = comsub;
 #if 0
 	nv_putval(SH_FUNNAMENOD,shp->st.funname,NV_NOFREE);
 #else