7165565 ksh93 in userland misses several bug fixes made in ON
authorEdwin Beasant <Edwin.Beasant@oracle.com>
Tue, 08 May 2012 23:48:08 +0100
changeset 805 23c55a2f8a8e
parent 804 6652c7c4eb82
child 806 ddaaea069116
7165565 ksh93 in userland misses several bug fixes made in ON 7165448 7046434 is showing up again in s11u1_15 7165432 randomly coredumps in s11u1_15 when killing processes.
components/ksh93/Makefile
components/ksh93/patches/CR6729252.patch
components/ksh93/patches/CR6917338.patch
components/ksh93/patches/CR6934836.patch
components/ksh93/patches/CR6964621.patch
components/ksh93/patches/CR7009897.patch
components/ksh93/patches/CR7019368.patch
components/ksh93/patches/CR7032068.patch
components/ksh93/patches/CR7032821.patch
components/ksh93/patches/CR7033181.patch
components/ksh93/patches/CR7046434.patch
components/ksh93/patches/CR7061011.patch
components/ksh93/patches/CR7089799.patch
components/ksh93/patches/MAP_TYPE_64_Bits.patch
--- a/components/ksh93/Makefile	Tue May 08 09:45:06 2012 +1200
+++ b/components/ksh93/Makefile	Tue May 08 23:48:08 2012 +0100
@@ -57,13 +57,22 @@
     sha256:44ae3913e6c0c8992c6c3cba16864fd4c4a18c6da8e7d87c85a23060cea7cd1a
 COMPONENT_ARCHIVE_URL_1= http://www2.research.att.com/~gsf/download/tgz/$(COMPONENT_ARCHIVE_1)
 COMPONENT_PATCHES_1= solaris_alias.patch build_cflags.patch path_utmp.patch \
-					 CR6919590.patch CR7032821.patch CR7071431.patch \
-					 CR6964621.patch CR7036535.patch \
+					 CR6919590.patch CR7033181.patch \
+					 CR7071431.patch CR7036535.patch \
 					 CRXXX_Error_Catalog.patch CR7025778.patch \
 					 CR7065478.patch CR7026179.patch \
 					 CR7065900.patch CR7110983.patch \
 					 CR7105086.patch disable_dll.patch \
-					 CR7057565.patch
+					 CR7057565.patch CR7046434.patch \
+					 CR7032821.patch CR7009897.patch \
+					 CR6964621.patch CR7032068.patch \
+					 CR7061011.patch CR6934836.patch \
+					 CR7089799.patch CR6917338.patch \
+					 CR7019368.patch CR6729252.patch \
+					 MAP_TYPE_64_Bits.patch
+
+					 
+					 
 
 # Make the unpack of the second archive relocate to a sensible place
 UNPACK_ARGS_1= -r $(COMPONENT_SRC_1)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ksh93/patches/CR6729252.patch	Tue May 08 23:48:08 2012 +0100
@@ -0,0 +1,15 @@
+diff -rupN INIT.2011-02-08.clean/src/lib/libast/port/mnt.c INIT.2011-02-08/src/lib/libast/port/mnt.c
+--- INIT.2011-02-08.clean/src/lib/libast/port/mnt.c	2012-05-07 15:33:03.490042977 +0100
++++ INIT.2011-02-08/src/lib/libast/port/mnt.c	2012-05-07 15:40:58.347078946 +0100
[email protected]@ -416,11 +416,6 @@ mntread(void* handle)
+ 			t = "sfs";
+ 			break;
+ #endif
+-#ifdef MNT_CACHEFS
+-		case MNT_CACHEFS:
+-			t = "cachefs";
+-			break;
+-#endif
+ #ifdef MNT_NFS3
+ 		case MNT_NFS3:
+ 			t = "nfs3";
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ksh93/patches/CR6917338.patch	Tue May 08 23:48:08 2012 +0100
@@ -0,0 +1,14 @@
+diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/sh/xec.c INIT.2011-02-08/src/cmd/ksh93/sh/xec.c
+--- INIT.2011-02-08.clean/src/cmd/ksh93/sh/xec.c	2012-05-07 15:03:41.210885978 +0100
++++ INIT.2011-02-08/src/cmd/ksh93/sh/xec.c	2012-05-07 15:07:57.474149421 +0100
[email protected]@ -586,7 +586,10 @@ int sh_eval(register Sfio_t *iop, int mo
+ 	if(lineno)
+ 		shp->inlineno = lineno;
+ 	if(io_save)
++	{
+ 		sfclose(io_save);
++		io_save = 0;
++	}
+ 	sh_freeup(shp);
+ 	shp->st.staklist = saveslp;
+ 	shp->fn_reset = 0;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ksh93/patches/CR6934836.patch	Tue May 08 23:48:08 2012 +0100
@@ -0,0 +1,47 @@
+diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/sh/init.c INIT.2011-02-08/src/cmd/ksh93/sh/init.c
+--- INIT.2011-02-08.clean/src/cmd/ksh93/sh/init.c	2012-05-07 14:21:24.948093271 +0100
++++ INIT.2011-02-08/src/cmd/ksh93/sh/init.c	2012-05-07 14:30:52.907885321 +0100
[email protected]@ -1352,6 +1352,7 @@ Shell_t *sh_init(register int argc,regis
+ 	job_clear();
+ 	if(argc>0)
+ 	{
++		int dolv_index = -1;
+ 		/* check for restricted shell */
+ 		if(type&SH_TYPE_RESTRICTED)
+ 			sh_onoption(SH_RESTRICTED);
[email protected]@ -1379,7 +1380,10 @@ Shell_t *sh_init(register int argc,regis
+ 			sh_done(shp,0);
+ 		}
+ 		opt_info.disc = 0;
+-		shp->st.dolv=argv+(argc-1)-shp->st.dolc;
++		dolv_index = (argc-1)-shp->st.dolc;
++		shp->st.dolv=argv+dolv_index;
++		shp->st.repl_index = dolv_index;
++		shp->st.repl_arg = argv[dolv_index];	
+ 		shp->st.dolv[0] = argv[0];
+ 		if(shp->st.dolc < 1)
+ 			sh_onoption(SH_SFLAG);
+diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/sh/main.c INIT.2011-02-08/src/cmd/ksh93/sh/main.c
+--- INIT.2011-02-08.clean/src/cmd/ksh93/sh/main.c	2012-05-07 14:43:03.840822719 +0100
++++ INIT.2011-02-08/src/cmd/ksh93/sh/main.c	2012-05-07 14:59:12.341447529 +0100
[email protected]@ -296,6 +296,8 @@ int sh_main(int ac, char *av[], Shinit_f
+ 					 * try to undo effect of solaris 2.5+
+ 					 * change for argv for setuid scripts
+ 					 */
++					if (shp->st.repl_index > 0)
++						av[shp->st.repl_index] = shp->st.repl_arg;
+ 					if(((type = sh_type(cp = av[0])) & SH_TYPE_SH) && (!(name = nv_getval(L_ARGNOD)) || !((type = sh_type(cp = name)) & SH_TYPE_SH)))
+ 					{
+ 						av[0] = (type & SH_TYPE_LOGIN) ? cp : path_basename(cp);
+diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/include/defs.h INIT.2011-02-08/src/cmd/ksh93/include/defs.h
+--- INIT.2011-02-08.clean/src/cmd/ksh93/include/defs.h	2012-05-08 12:33:38.805834763 +0100
++++ INIT.2011-02-08/src/cmd/ksh93/include/defs.h	2012-05-08 12:36:40.987228722 +0100
[email protected]@ -97,6 +97,8 @@ struct sh_scoped
+ 	char		**otrapcom;
+ 	void		*timetrap;
+ 	struct Ufunction *real_fun;	/* current 'function name' function */
++	int             repl_index;
++	char            *repl_arg;
+ };
+ 
+ struct limits
--- a/components/ksh93/patches/CR6964621.patch	Tue May 08 09:45:06 2012 +1200
+++ b/components/ksh93/patches/CR6964621.patch	Tue May 08 23:48:08 2012 +0100
@@ -1,16 +1,39 @@
---- a/src/cmd/ksh93/sh/io.c	Tue Feb  8 17:15:45 2011
-+++ b/src/cmd/ksh93/sh/io.c	Tue Sep 27 10:48:45 2011
[email protected]@ -26,6 +26,9 @@
-  *   AT&T Labs
+diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/include/io.h INIT.2011-02-08/src/cmd/ksh93/include/io.h
+--- INIT.2011-02-08.clean/src/cmd/ksh93/include/io.h	2012-05-02 03:16:17.383778774 -0700
++++ INIT.2011-02-08/src/cmd/ksh93/include/io.h	2012-05-02 03:17:53.562408338 -0700
[email protected]@ -23,6 +23,9 @@
+  *	David Korn
   *
   */
 +/*
-+ * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
 + */
  
- #include	"defs.h"
- #include	<fcin.h>
[email protected]@ -596,8 +599,10 @@
+ #include	<ast.h>
+ #include	<sfio.h>
[email protected]@ -84,6 +87,12 @@ extern int	sh_devtofd(const char*);
+ extern int	sh_isdevfd(const char*);
+ extern int	sh_source(Shell_t*, Sfio_t*, const char*);
+ 
++extern int	VALIDATE_FD(Shell_t *, int);
++
++#define	VALIDATE_FD(shp, fd) \
++	(((fd) >= (shp)->gd->lim.open_max) ? sh_iovalidfd(shp, fd) : 1)
++
++
+ /* the following are readonly */
+ extern const char	e_pexists[];
+ extern const char	e_query[];
[email protected]@ -123,4 +132,5 @@ extern const char	e_bash_profile[];
+ extern const char	e_stdprompt[];
+ extern const char	e_supprompt[];
+ extern const char	e_ambiguous[];
++
+ #endif /* KSHELL */
+diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/sh/io.c INIT.2011-02-08/src/cmd/ksh93/sh/io.c
+--- INIT.2011-02-08.clean/src/cmd/ksh93/sh/io.c	2012-05-02 03:16:17.389917698 -0700
++++ INIT.2011-02-08/src/cmd/ksh93/sh/io.c	2012-05-02 03:19:12.669621809 -0700
[email protected]@ -596,8 +596,10 @@ static void io_preserve(Shell_t* shp, re
  		((struct checkpt*)shp->jmplist)->mode = SH_JMPERREXIT;
  		errormsg(SH_DICT,ERROR_system(1),e_toomany);
  	}
@@ -23,7 +46,7 @@
  	if(shp->fdptrs[fd]=shp->fdptrs[f2])
  	{
  		if(f2==job.fd)
[email protected]@ -623,7 +628,12 @@
[email protected]@ -623,7 +625,12 @@ static void io_preserve(Shell_t* shp, re
   */
  int sh_iorenumber(Shell_t *shp, register int f1,register int f2)
  {
@@ -37,7 +60,7 @@
  	if(f1!=f2)
  	{
  		/* see whether file descriptor is in use */
[email protected]@ -663,8 +673,7 @@
[email protected]@ -663,8 +670,7 @@ int sh_iorenumber(Shell_t *shp, register
  		if(f2<=2)
  			sfset(sp,SF_SHARE|SF_PUBLIC,1);
  	}
@@ -47,7 +70,7 @@
  	return(f2);
  }
  
[email protected]@ -678,8 +687,9 @@
[email protected]@ -678,8 +684,9 @@ int sh_close(register int fd)
  	register int r = 0;
  	if(fd<0)
  		return(-1);
@@ -59,7 +82,7 @@
  	if(!(sp=shp->sftable[fd]) || sfclose(sp) < 0)
  	{
  		if(fdnotify)
[email protected]@ -835,6 +845,9 @@
[email protected]@ -835,6 +842,9 @@ int sh_open(register const char *path, i
  		mode = (IOREAD|IOWRITE);
  	else
  		mode = IOREAD;
@@ -69,32 +92,16 @@
  	shp->fdstatus[fd] = mode;
  	return(fd);
  }
[email protected]@ -858,9 +871,15 @@
- {
- 	Shell_t *shp = sh_getinterp();
- 	register int fdnew;
-+
-+	VALIDATE_FD(shp, fdold);
-+
[email protected]@ -861,6 +871,8 @@ int sh_iomovefd(register int fdold)
  	if(fdold<0 || fdold>2)
  		return(fdold);
  	fdnew = sh_iomovefd(dup(fdold));
-+
++	VALIDATE_FD(shp, fdold);
 +	VALIDATE_FD(shp, fdnew);
-+
  	shp->fdstatus[fdnew] = (shp->fdstatus[fdold]&~IOCLEX);
  	close(fdold);
  	shp->fdstatus[fdold] = IOCLOSE;
[email protected]@ -878,6 +897,8 @@
- 		errormsg(SH_DICT,ERROR_system(1),e_pipe);
- 	pv[0] = sh_iomovefd(pv[0]);
- 	pv[1] = sh_iomovefd(pv[1]);
-+	VALIDATE_FD(shp, pv[0]);
-+	VALIDATE_FD(shp, pv[1]);
- 	shp->fdstatus[pv[0]] = IONOSEEK|IOREAD;
- 	shp->fdstatus[pv[1]] = IONOSEEK|IOWRITE;
- 	sh_subsavefd(pv[0]);
[email protected]@ -897,6 +918,9 @@
[email protected]@ -897,6 +909,9 @@ int	sh_pipe(register int pv[])
  		sh_close(fd);
  	else
  		pv[out] = sh_iomovefd(fd);
@@ -104,7 +111,7 @@
  	if(fcntl(pv[out],F_SETFD,FD_CLOEXEC) >=0)
  		shp->fdstatus[pv[out]] |= IOCLEX;
  	shp->fdstatus[pv[out]] = (out?IOWRITE:IOREAD);
[email protected]@ -929,6 +953,9 @@
[email protected]@ -929,6 +944,9 @@ int	sh_pipe(register int pv[])
  		errormsg(SH_DICT,ERROR_system(1),e_pipe);
  	}
  	fcntl(pv[out],F_SETFD,FD_CLOEXEC);
@@ -114,7 +121,7 @@
  	shp->fdstatus[pv[out]] |= IOCLEX;
  	pv[1-out] = -1;
  	pv[2] = port;
[email protected]@ -958,9 +985,13 @@
[email protected]@ -958,9 +976,13 @@ static int pat_line(const regex_t* rp, c
  static int io_patseek(Shell_t *shp, regex_t *rp, Sfio_t* sp, int flags)
  {
  	char	*cp, *match;
@@ -129,7 +136,7 @@
  	shp->fdstatus[sffileno(sp)] |= IOCLEX;
  	if(fd==0)
  		was_share = sfset(sp,SF_SHARE,1);
[email protected]@ -994,12 +1025,17 @@
[email protected]@ -994,12 +1016,17 @@ static int io_patseek(Shell_t *shp, rege
  
  static Sfoff_t	file_offset(Shell_t *shp, int fn, char *fname)
  {
@@ -148,7 +155,7 @@
  	memset(&endf,0,sizeof(struct Eof));
  	endf.fd = fn;
  	endf.hdr.disc = &EOF_disc;
[email protected]@ -1169,7 +1205,7 @@
[email protected]@ -1169,7 +1196,7 @@ int	sh_redirect(Shell_t *shp,struct iono
  			if((iof&IOLSEEK) || ((iof&IOMOV) && *fname=='-'))
  				fn = nv_getnum(np);
  		}
@@ -157,7 +164,7 @@
  			errormsg(SH_DICT,ERROR_system(1),e_file+4);
  		if(iof&IOLSEEK)
  		{
[email protected]@ -1212,6 +1248,7 @@
[email protected]@ -1212,6 +1239,7 @@ int	sh_redirect(Shell_t *shp,struct iono
  						message = e_file;
  						goto fail;
  					}
@@ -165,7 +172,7 @@
  					if(shp->subshell && dupfd==1)
  					{
  						if(sfset(sfstdout,0,0)&SF_STRING)
[email protected]@ -1248,8 +1285,7 @@
[email protected]@ -1248,8 +1276,7 @@ int	sh_redirect(Shell_t *shp,struct iono
  					goto traceit;
  				if((fd=sh_fcntl(dupfd,F_DUPFD,3))<0)
  					goto fail;
@@ -175,7 +182,7 @@
  				sh_iocheckfd(shp,dupfd);
  				shp->fdstatus[fd] = (shp->fdstatus[dupfd]&~IOCLEX);
  				if(toclose<0 && shp->fdstatus[fd]&IOREAD)
[email protected]@ -1362,7 +1398,11 @@
[email protected]@ -1362,7 +1389,11 @@ int	sh_redirect(Shell_t *shp,struct iono
  			}
  			if(iof&IOLSEEK)
  			{
@@ -188,7 +195,7 @@
  				r = shp->fdstatus[fn];
  				if(!(r&(IOSEEK|IONOSEEK)))
  					r = sh_iocheckfd(shp,fn);
[email protected]@ -1443,6 +1483,7 @@
[email protected]@ -1443,6 +1474,7 @@ int	sh_redirect(Shell_t *shp,struct iono
  			}
  			if(fd<0)
  			{
@@ -196,7 +203,7 @@
  				if(sh_inuse(shp,fn) || (fn && fn==shp->infd))
  				{
  					if(fn>9 || !(shp->inuse_bits&(1<<fn)))
[email protected]@ -1462,7 +1503,7 @@
[email protected]@ -1462,7 +1494,7 @@ int	sh_redirect(Shell_t *shp,struct iono
  					{
  						if((fn=fcntl(fd,F_DUPFD,10)) < 0)
  							goto fail;
@@ -205,7 +212,7 @@
  							goto fail;
  						shp->fdstatus[fn] = shp->fdstatus[fd];
  						sh_close(fd);
[email protected]@ -1622,7 +1663,12 @@
[email protected]@ -1622,7 +1654,12 @@ void sh_iosave(Shell_t *shp, register in
  	filemap[shp->topfd++].save_fd = savefd;
  	if(savefd >=0)
  	{
@@ -219,7 +226,7 @@
  		/* make saved file close-on-exec */
  		sh_fcntl(savefd,F_SETFD,FD_CLOEXEC);
  		if(origfd==job.fd)
[email protected]@ -1655,6 +1701,7 @@
[email protected]@ -1655,6 +1692,7 @@ void	sh_iounsave(Shell_t* shp)
  			filemap[newfd++] = filemap[fd];
  		else
  		{
@@ -227,7 +234,7 @@
  			shp->sftable[savefd] = 0;
  			sh_close(savefd);
  		}
[email protected]@ -1678,6 +1725,7 @@
[email protected]@ -1678,16 +1716,19 @@ void	sh_iorestore(Shell_t *shp, int last
  		{
  			if ((savefd = filemap[fd].save_fd) >= 0)
  			{
@@ -235,7 +242,6 @@
  				shp->sftable[savefd] = 0;
  				sh_close(savefd);
  			}
[email protected]@ -1684,10 +1732,12 @@
  			continue;
  		}
  		origfd = filemap[fd].orig_fd;
@@ -248,7 +254,7 @@
  			shp->sftable[savefd] = 0;
  			sh_close(savefd);
  			return;
[email protected]@ -1699,6 +1749,7 @@
[email protected]@ -1699,6 +1740,7 @@ void	sh_iorestore(Shell_t *shp, int last
  		sh_close(origfd);
  		if ((savefd = filemap[fd].save_fd) >= 0)
  		{
@@ -256,7 +262,7 @@
  			sh_fcntl(savefd, F_DUPFD, origfd);
  			if(savefd==job.fd)
  				job.fd=origfd;
[email protected]@ -1954,6 +2005,9 @@
[email protected]@ -1954,6 +1996,9 @@ static ssize_t slowread(Sfio_t *iop,void
  int sh_iocheckfd(Shell_t *shp, register int fd)
  {
  	register int flags, n;
@@ -266,7 +272,7 @@
  	if((n=shp->fdstatus[fd])&IOCLOSE)
  		return(n);
  	if(!(n&(IOREAD|IOWRITE)))
[email protected]@ -2145,7 +2199,7 @@
[email protected]@ -2145,7 +2190,7 @@ static void	sftrack(Sfio_t* sp, int flag
  		return;
  	}
  #endif
@@ -275,7 +281,7 @@
  		return;
  	if(sh_isstate(SH_NOTRACK))
  		return;
[email protected]@ -2413,6 +2467,8 @@
[email protected]@ -2413,6 +2458,8 @@ ssize_t sh_read(register int fd, void* b
  {
  	Shell_t *shp = sh_getinterp();
  	register Sfio_t *sp;
@@ -284,7 +290,7 @@
  	if(sp=shp->sftable[fd])
  		return(sfread(sp,buff,n));
  	else
[email protected]@ -2427,6 +2483,8 @@
[email protected]@ -2427,6 +2474,8 @@ ssize_t sh_write(register int fd, const 
  {
  	Shell_t *shp = sh_getinterp();
  	register Sfio_t *sp;
@@ -293,7 +299,7 @@
  	if(sp=shp->sftable[fd])
  		return(sfwrite(sp,buff,n));
  	else
[email protected]@ -2441,6 +2499,8 @@
[email protected]@ -2441,6 +2490,8 @@ off_t sh_seek(register int fd, off_t off
  {
  	Shell_t *shp = sh_getinterp();
  	register Sfio_t *sp;
@@ -302,7 +308,7 @@
  	if((sp=shp->sftable[fd]) && (sfset(sp,0,0)&(SF_READ|SF_WRITE)))
  		return(sfseek(sp,offset,whence));
  	else
[email protected]@ -2452,6 +2512,9 @@
[email protected]@ -2452,6 +2503,9 @@ int sh_dup(register int old)
  {
  	Shell_t *shp = sh_getinterp();
  	register int fd = dup(old);
@@ -312,7 +318,7 @@
  	if(fd>=0)
  	{
  		if(shp->fdstatus[old] == IOCLOSE)
[email protected]@ -2473,13 +2536,15 @@
[email protected]@ -2473,13 +2527,15 @@ int sh_fcntl(register int fd, int op, ..
  	arg =  va_arg(ap, int) ;
  	va_end(ap);
  	newfd = fcntl(fd,op,arg);
@@ -330,7 +336,7 @@
  		shp->fdstatus[newfd] = (shp->fdstatus[fd]&~IOCLEX);
  		if(fdnotify)
  			(*fdnotify)(fd,newfd);
[email protected]@ -2548,6 +2613,7 @@
[email protected]@ -2548,6 +2604,7 @@ Sfio_t *sh_iogetiop(int fd, int mode)
  		return(iop);
  	if(mode==SF_READ && !(n&IOREAD))
  		return(iop);
@@ -338,7 +344,7 @@
  	if(!(iop = shp->sftable[fd]))
  		iop=sh_iostream(shp,fd);
  	return(iop);
[email protected]@ -2567,7 +2633,10 @@
[email protected]@ -2567,7 +2624,10 @@ Sfio_t	*sh_fd2sfio(int fd)
  {
  	Shell_t	*shp = sh_getinterp();
  	register int status;
@@ -350,50 +356,20 @@
  	if(!sp  && (status = sh_iocheckfd(shp,fd))!=IOCLOSE)
  	{
  		register int flags=0;
---- a/src/cmd/ksh93/include/io.h	Mon Nov 29 15:02:53 2010
-+++ b/src/cmd/ksh93/include/io.h	Tue Aug 30 13:06:36 2011
[email protected]@ -23,6 +23,9 @@
-  *	David Korn
-  *
-  */
-+/*
-+ * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
-+ */
- 
- #include	<ast.h>
- #include	<sfio.h>
[email protected]@ -84,6 +87,12 @@
- extern int	sh_isdevfd(const char*);
- extern int	sh_source(Shell_t*, Sfio_t*, const char*);
- 
-+extern int	VALIDATE_FD(Shell_t *, int);
-+
-+#define	VALIDATE_FD(shp, fd) \
-+	(((fd) >= (shp)->gd->lim.open_max) ? sh_iovalidfd(shp, fd) : 1)
-+
-+
- /* the following are readonly */
- extern const char	e_pexists[];
- extern const char	e_query[];
[email protected]@ -123,4 +132,5 @@
- extern const char	e_stdprompt[];
- extern const char	e_supprompt[];
- extern const char	e_ambiguous[];
-+
- #endif /* KSHELL */
---- a/src/cmd/ksh93/sh/lex.c	Fri Jan  7 16:37:35 2011
-+++ b/src/cmd/ksh93/sh/lex.c	Tue Aug 30 13:06:36 2011
+diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/sh/lex.c INIT.2011-02-08/src/cmd/ksh93/sh/lex.c
+--- INIT.2011-02-08.clean/src/cmd/ksh93/sh/lex.c	2012-05-02 03:16:17.388010187 -0700
++++ INIT.2011-02-08/src/cmd/ksh93/sh/lex.c	2012-05-02 03:17:53.567785551 -0700
 @@ -25,6 +25,9 @@
   * AT&T Labs
   *
   */
 +/*
-+ * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
 + */
  
  #include	<ast.h>
  #include	<stak.h>
[email protected]@ -2053,6 +2056,7 @@
[email protected]@ -2053,6 +2056,7 @@ void	sh_syntax(Lex_t *lp)
  	else
  		lp->lastline = shp->inlineno;
  	tokstr = fmttoken(lp,tok,tokbuf);
@@ -401,9 +377,31 @@
  	if((sp=fcfile()) || (shp->infd>=0 && (sp=shp->sftable[shp->infd])))
  	{
  		/* clear out any pending input */
---- a/src/cmd/ksh93/sh/main.c	Wed Dec  1 22:10:07 2010
-+++ b/src/cmd/ksh93/sh/main.c	Tue Aug 30 13:06:36 2011
[email protected]@ -396,8 +401,10 @@
+diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/sh/macro.c INIT.2011-02-08/src/cmd/ksh93/sh/macro.c
+--- INIT.2011-02-08.clean/src/cmd/ksh93/sh/macro.c	2012-05-02 03:16:26.100861446 -0700
++++ INIT.2011-02-08/src/cmd/ksh93/sh/macro.c	2012-05-02 03:17:53.569195199 -0700
[email protected]@ -2086,6 +2086,7 @@ static void comsubst(Mac_t *mp,register 
+ 			sh_popcontext(mp->shp,&buff);
+ 			if(r==0 && ip && (ip->iofile&IOLSEEK))
+ 			{
++				VALIDATE_FD(mp->shp, fd);
+ 				if(sp=mp->shp->sftable[fd])
+ 					num = sftell(sp);
+ 				else
+diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/sh/main.c INIT.2011-02-08/src/cmd/ksh93/sh/main.c
+--- INIT.2011-02-08.clean/src/cmd/ksh93/sh/main.c	2012-05-02 03:16:17.389138504 -0700
++++ INIT.2011-02-08/src/cmd/ksh93/sh/main.c	2012-05-02 03:17:53.570027033 -0700
[email protected]@ -26,6 +26,9 @@
+  * AT&T Labs
+  *
+  */
++/*
++ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
++ */
+ 
+ #include	<ast.h>
+ #include	<sfio.h>
[email protected]@ -396,8 +399,10 @@ static void	exfile(register Shell_t *shp
  		if(fno > 0)
  		{
  			int r;
@@ -414,27 +412,20 @@
  				shp->fdstatus[r] = shp->fdstatus[fno];
  				sh_close(fno);
  				fno = r;
---- a/src/cmd/ksh93/sh/path.c	Mon Nov 22 20:55:38 2010
-+++ b/src/cmd/ksh93/sh/path.c	Tue Sep 27 10:48:45 2011
+diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/sh/path.c INIT.2011-02-08/src/cmd/ksh93/sh/path.c
+--- INIT.2011-02-08.clean/src/cmd/ksh93/sh/path.c	2012-05-02 03:16:20.752378905 -0700
++++ INIT.2011-02-08/src/cmd/ksh93/sh/path.c	2012-05-02 03:17:53.571078341 -0700
 @@ -23,6 +23,9 @@
   * AT&T Labs
   *
   */
 +/*
-+ * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
 + */
  
  #include	"defs.h"
  #include	<fcin.h>
[email protected]@ -562,6 +565,7 @@
- 	if(fd>=0 && (fd = sh_iomovefd(fd)) > 0)
- 	{
- 		fcntl(fd,F_SETFD,FD_CLOEXEC);
-+		VALIDATE_FD(shp, fd);
- 		shp->fdstatus[fd] |= IOCLEX;
- 	}
- 	return(fd);
[email protected]@ -1239,6 +1243,7 @@
[email protected]@ -1239,6 +1242,7 @@ static void exscript(Shell_t *shp,regist
  	if(sp=fcfile())
  		while(sfstack(sp,SF_POPSTACK));
  	job_clear();
@@ -442,19 +433,37 @@
  	if(shp->infd>0 && (shp->fdstatus[shp->infd]&IOCLEX))
  		sh_close(shp->infd);
  	sh_setstate(sh_state(SH_FORKED));
---- a/src/cmd/ksh93/sh/xec.c	Tue Feb  8 19:08:15 2011
-+++ b/src/cmd/ksh93/sh/xec.c	Tue Aug 30 13:06:36 2011
[email protected]@ -25,6 +25,9 @@
-  *   AT&T Labs
-  *
-  */
-+/*
-+ * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
-+ */
- 
- #include	"defs.h"
- #include	<fcin.h>
[email protected]@ -94,6 +97,8 @@
+diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/sh/subshell.c INIT.2011-02-08/src/cmd/ksh93/sh/subshell.c
+--- INIT.2011-02-08.clean/src/cmd/ksh93/sh/subshell.c	2012-05-02 03:16:25.241021529 -0700
++++ INIT.2011-02-08/src/cmd/ksh93/sh/subshell.c	2012-05-02 03:17:53.571942019 -0700
[email protected]@ -115,6 +115,7 @@ void	sh_subtmpfile(Shell_t *shp)
+ 		if((sp->tmpfd = fd = fcntl(1,F_DUPFD,10)) >= 0)
+ 		{
+ 			fcntl(fd,F_SETFD,FD_CLOEXEC);
++			VALIDATE_FD(shp, fd);
+ 			shp->fdstatus[fd] = shp->fdstatus[1]|IOCLEX;
+ 			close(1);
+ 		}
[email protected]@ -141,6 +142,7 @@ void	sh_subtmpfile(Shell_t *shp)
+ 		}
+ 		else
+ 		{
++			VALIDATE_FD(shp, fd);
+ 			shp->fdstatus[fd] = IOREAD|IOWRITE;
+ 			sfsync(sfstdout);
+ 			if(fd==1)
[email protected]@ -627,6 +629,7 @@ Sfio_t *sh_subshell(Shell_t *shp,Shnode_
+ 					((struct checkpt*)shp->jmplist)->mode = SH_JMPERREXIT;
+ 					errormsg(SH_DICT,ERROR_system(1),e_toomany);
+ 				}
++				VALIDATE_FD(shp, fd);
+ 				shp->sftable[fd] = iop;
+ 				fcntl(fd,F_SETFD,FD_CLOEXEC);
+ 				shp->fdstatus[fd] = (shp->fdstatus[1]|IOCLEX);
+diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/sh/xec.c INIT.2011-02-08/src/cmd/ksh93/sh/xec.c
+--- INIT.2011-02-08.clean/src/cmd/ksh93/sh/xec.c	2012-05-02 03:16:17.393286735 -0700
++++ INIT.2011-02-08/src/cmd/ksh93/sh/xec.c	2012-05-02 03:17:53.574535124 -0700
[email protected]@ -94,6 +94,8 @@ static void iousepipe(Shell_t *shp)
  	usepipe++;
  	fcntl(subpipe[0],F_SETFD,FD_CLOEXEC);
  	subpipe[2] = fcntl(1,F_DUPFD,10);
@@ -463,7 +472,7 @@
  	shp->fdstatus[subpipe[2]] = shp->fdstatus[1];
  	close(1);
  	fcntl(subpipe[1],F_DUPFD,1);
[email protected]@ -117,6 +122,7 @@
[email protected]@ -117,6 +119,7 @@ static void iounpipe(Shell_t *shp)
  	usepipe = 0;
  	close(1);
  	fcntl(subpipe[2], F_DUPFD, 1);
@@ -471,18 +480,7 @@
  	shp->fdstatus[1] = shp->fdstatus[subpipe[2]];
  	if(subdup) for(n=0; n < 10; n++)
  	{
[email protected]@ -583,7 +589,10 @@
- 	if(lineno)
- 		shp->inlineno = lineno;
- 	if(io_save)
-+	{
- 		sfclose(io_save);
-+		io_save = 0;
-+	}
- 	sh_freeup(shp);
- 	shp->st.staklist = saveslp;
- 	shp->fn_reset = 0;
[email protected]@ -844,6 +853,7 @@
[email protected]@ -844,6 +847,7 @@ static int sh_coexec(Shell_t *shp,const 
  			if(filt > 2)
  			{
  				shp->coutpipe = shp->inpipe[1];
@@ -490,7 +488,7 @@
  				shp->fdptrs[shp->coutpipe] = &shp->coutpipe;
  			}
  		}
[email protected]@ -1487,6 +1497,7 @@
[email protected]@ -1487,6 +1491,7 @@ int sh_exec(register const Shnode_t *t, 
  						if(shp->cpipe[0]<0 || shp->cpipe[1] < 0)
  						{
  							sh_copipe(shp,shp->outpipe=shp->cpipe,0);
@@ -498,7 +496,7 @@
  							shp->fdptrs[shp->cpipe[0]] = shp->cpipe;
  						}
  						sh_copipe(shp,shp->inpipe=pipes,0);
[email protected]@ -3419,6 +3430,8 @@
[email protected]@ -3419,6 +3424,8 @@ static void coproc_init(Shell_t *shp, in
  		if((outfd=shp->cpipe[1]) < 10) 
  		{
  		        int fd=fcntl(shp->cpipe[1],F_DUPFD,10);
@@ -507,7 +505,7 @@
  			if(fd>=10)
  			{
  			        shp->fdstatus[fd] = (shp->fdstatus[outfd]&~IOCLEX);
[email protected]@ -3427,6 +3440,9 @@
[email protected]@ -3427,6 +3434,9 @@ static void coproc_init(Shell_t *shp, in
  				shp->cpipe[1] = fd;
  			}
  		}
@@ -517,7 +515,7 @@
  		if(fcntl(*shp->cpipe,F_SETFD,FD_CLOEXEC)>=0)
  			shp->fdstatus[shp->cpipe[0]] |= IOCLEX;
  		shp->fdptrs[shp->cpipe[0]] = shp->cpipe;
[email protected]@ -3437,7 +3453,9 @@
[email protected]@ -3437,7 +3447,9 @@ static void coproc_init(Shell_t *shp, in
  	shp->outpipe = shp->cpipe;
  	sh_pipe(shp->inpipe=pipes);
  	shp->coutpipe = shp->inpipe[1];
@@ -527,7 +525,7 @@
  	if(fcntl(shp->outpipe[0],F_SETFD,FD_CLOEXEC)>=0)
  		shp->fdstatus[shp->outpipe[0]] |= IOCLEX;
  }
[email protected]@ -3608,6 +3626,7 @@
[email protected]@ -3608,6 +3620,7 @@ static pid_t sh_ntfork(Shell_t *shp,cons
  				int fd = shp->inpipe[1];
  				sh_iosave(shp,0,buff.topfd,(char*)0);
  				sh_iorenumber(shp,shp->inpipe[0],0);
@@ -535,7 +533,7 @@
  				if(fd>=0 && (!(otype&FPOU) || (otype&FCOOP)) && fcntl(fd,F_SETFD,FD_CLOEXEC)>=0)
  					shp->fdstatus[fd] |= IOCLEX;
  			}
[email protected]@ -3619,6 +3638,7 @@
[email protected]@ -3619,6 +3632,7 @@ static pid_t sh_ntfork(Shell_t *shp,cons
  #endif /* SHOPT_COSHELL */
  				sh_iosave(shp,1,buff.topfd,(char*)0);
  				sh_iorenumber(shp,sh_dup(shp->outpipe[1]),1);
@@ -543,7 +541,7 @@
  				if(fcntl(shp->outpipe[0],F_SETFD,FD_CLOEXEC)>=0)
  					shp->fdstatus[shp->outpipe[0]] |= IOCLEX;
  			}
[email protected]@ -3658,6 +3678,7 @@
[email protected]@ -3658,6 +3672,7 @@ static pid_t sh_ntfork(Shell_t *shp,cons
  			signal(SIGQUIT,sh_fault);
  			signal(SIGINT,sh_fault);
  		}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ksh93/patches/CR7009897.patch	Tue May 08 23:48:08 2012 +0100
@@ -0,0 +1,33 @@
+diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/sh/macro.c INIT.2011-02-08/src/cmd/ksh93/sh/macro.c
+--- INIT.2011-02-08.clean/src/cmd/ksh93/sh/macro.c	2012-05-02 01:59:48.571110152 -0700
++++ INIT.2011-02-08/src/cmd/ksh93/sh/macro.c	2012-05-02 02:05:56.082206972 -0700
[email protected]@ -1262,7 +1262,7 @@ retry1:
+ 				stkseek(stkp,stktell(stkp)-2);
+ 				nv_local = 1;
+ 			}
+-			else
++			else if (type != M_VNAME)
+ 			{
+ 				stkseek(stkp,stktell(stkp)-1);
+ 				type = M_TREE;
+diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/sh/nvtree.c INIT.2011-02-08/src/cmd/ksh93/sh/nvtree.c
+--- INIT.2011-02-08.clean/src/cmd/ksh93/sh/nvtree.c	2012-05-02 01:59:52.497548227 -0700
++++ INIT.2011-02-08/src/cmd/ksh93/sh/nvtree.c	2012-05-02 02:07:16.084944399 -0700
[email protected]@ -1069,7 +1069,7 @@ Namfun_t *nv_isvtree(Namval_t *np)
+  */
+ char *nv_getvtree(register Namval_t *np, Namfun_t *fp)
+ {
+-	int flags=0, dsize=fp->dsize;
++	int flags=0;
+ 	for(; fp && fp->next; fp=fp->next)
+ 	{
+ 		if(fp->next->disc && (fp->next->disc->getnum || fp->next->disc->getval))
[email protected]@ -1083,7 +1083,7 @@ char *nv_getvtree(register Namval_t *np,
+ 		nv_offattr(np,NV_EXPORT);
+ 	if(flags |= nv_isattr(np,NV_TABLE))
+ 		nv_offattr(np,NV_TABLE);
+-	if(dsize && (flags&NV_EXPORT))
++	if( (fp) && (fp->dsize) && (flags&NV_EXPORT))
+ 		return("()");
+ 	return(walk_tree(np,(Namval_t*)0,flags));
+ }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ksh93/patches/CR7019368.patch	Tue May 08 23:48:08 2012 +0100
@@ -0,0 +1,48 @@
+diff -rupN INIT.2011-02-08/src/cmd/INIT/regress.sh INIT.2011-02-08.clean/src/cmd/INIT/regress.sh
+--- INIT.2011-02-08/src/cmd/INIT/regress.sh	2010-06-13 16:38:43.000000000 +0100
++++ INIT.2011-02-08.clean/src/cmd/INIT/regress.sh	2012-05-07 15:27:52.975530153 +0100
[email protected]@ -1351,7 +1351,7 @@ esac
+ export COLUMNS=80
+ SOURCE=$PWD
+ PATH=$SOURCE:${PATH#?(.):}
+-PATH=${PATH%%:?(.)}:/usr/5bin:/bin:/usr/bin
++PATH=${PATH%%:?(.)}:/bin:/usr/bin
+ UNIT=$1
+ shift
+ if	[[ -f $UNIT && ! -x $UNIT ]]
+diff -rupN INIT.2011-02-08/src/lib/libast/comp/mkdir.c INIT.2011-02-08.clean/src/lib/libast/comp/mkdir.c
+--- INIT.2011-02-08/src/lib/libast/comp/mkdir.c	2012-05-07 15:23:37.437905060 +0100
++++ INIT.2011-02-08.clean/src/lib/libast/comp/mkdir.c	2012-05-07 15:25:03.856907633 +0100
[email protected]@ -39,7 +39,7 @@ mkdir(const char* path, mode_t mode)
+ 	register int	n;
+ 	char*		av[3];
+ 
+-	static char*	cmd[] = { "/bin/mkdir", "/usr/5bin/mkdir", 0 };
++	static char*	cmd[] = { "/bin/mkdir", 0 };
+ 
+ 
+ 	n = errno;
+diff -rupN INIT.2011-02-08/src/lib/libast/comp/rmdir.c INIT.2011-02-08.clean/src/lib/libast/comp/rmdir.c
+--- INIT.2011-02-08/src/lib/libast/comp/rmdir.c	2012-05-07 15:23:37.439623862 +0100
++++ INIT.2011-02-08.clean/src/lib/libast/comp/rmdir.c	2012-05-07 15:25:25.119862860 +0100
[email protected]@ -39,7 +39,7 @@ rmdir(const char* path)
+ 	struct stat	st;
+ 	char*		av[3];
+ 
+-	static char*	cmd[] = { "/bin/rmdir", "/usr/5bin/rmdir", 0 };
++	static char*	cmd[] = { "/bin/rmdir", 0 };
+ 
+ 	if (stat(path, &st) < 0) return(-1);
+ 	if (!S_ISDIR(st.st_mode))
+diff -rupN INIT.2011-02-08/src/lib/libast/port/astconf.c INIT.2011-02-08.clean/src/lib/libast/port/astconf.c
+--- INIT.2011-02-08/src/lib/libast/port/astconf.c	2012-05-07 15:23:37.452538787 +0100
++++ INIT.2011-02-08.clean/src/lib/libast/port/astconf.c	2012-05-07 15:27:12.365726756 +0100
[email protected]@ -565,7 +565,7 @@ initialize(register Feature_t* fp, const
+ 						}
+ 						if (fp->op == OP_universe)
+ 						{
+-							if (strneq(p, "xpg", 3) || strneq(p, "5bin", 4))
++							if (strneq(p, "xpg", 3))
+ 							{
+ 								ok = 1;
+ 								break;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ksh93/patches/CR7032068.patch	Tue May 08 23:48:08 2012 +0100
@@ -0,0 +1,33 @@
+diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/sh/macro.c INIT.2011-02-08/src/cmd/ksh93/sh/macro.c
+--- INIT.2011-02-08.clean/src/cmd/ksh93/sh/macro.c	2012-05-02 03:34:48.830258020 -0700
++++ INIT.2011-02-08/src/cmd/ksh93/sh/macro.c	2012-05-02 03:42:51.584924888 -0700
[email protected]@ -1084,7 +1084,7 @@ static int varsub(Mac_t *mp)
+ {
+ 	register int	c;
+ 	register int	type=0; /* M_xxx */
+-	register char	*v,*argp=0;
++	register char	*v, *new_v = NULL, *argp=0;
+ 	register Namval_t	*np = NIL(Namval_t*);
+ 	register int 	dolg=0, mode=0;
+ 	Lex_t		*lp = (Lex_t*)mp->shp->lex_context;
[email protected]@ -1436,6 +1436,7 @@ retry1:
+ 				if( (mp->arith||mp->let) && (np->nvfun || nv_isattr(np,(NV_LJUST|NV_RJUST|NV_ZFILL))) && !nv_isattr(np,NV_INTEGER) && (offset==0 || !isalnum(c)))
+ 					mp->zeros = 1;
+ 			}
++			new_v = v = strdup(v);
+ 			if(savptr==stakptr(0))
+ 				stkseek(stkp,offset);
+ 			else
[email protected]@ -1963,8 +1964,12 @@ retry2:
+ 	}
+ 	if(np)
+ 		nv_close(np);
++ 	if (new_v)
++		free(new_v);
+ 	return(1);
+ nosub:
++	if (new_v)
++		free(new_v);
+ 	if(type==M_BRACE && sh_lexstates[ST_NORM][c]==S_BREAK)
+ 	{
+ 		fcseek(-1);
--- a/components/ksh93/patches/CR7032821.patch	Tue May 08 09:45:06 2012 +1200
+++ b/components/ksh93/patches/CR7032821.patch	Tue May 08 23:48:08 2012 +0100
@@ -1,11 +1,11 @@
---- a/src/cmd/ksh93/bltins/typeset.c	Fri Dec 31 00:15:57 2010
-+++ b/src/cmd/ksh93/bltins/typeset.c	Tue Jun 28 13:59:53 2011
[email protected]@ -608,7 +608,7 @@
- 			}
- 			if(!nv_isarray(np) && !strchr(name,'=') && !(shp->envlist  && nv_onlist(shp->envlist,name)))
+diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/sh/jobs.c INIT.2011-02-08/src/cmd/ksh93/sh/jobs.c
+--- INIT.2011-02-08.clean/src/cmd/ksh93/sh/jobs.c	2012-05-08 12:44:12.309610229 +0100
++++ INIT.2011-02-08/src/cmd/ksh93/sh/jobs.c	2012-05-08 12:48:34.559797683 +0100
[email protected]@ -950,6 +950,7 @@ int job_walk(Sfio_t *file,int (*fun)(str
+ 			if(!(pw = job_bypid(pid)))
  			{
--				if(comvar || (shp->last_root==shp->var_tree && (tp->tp || (!shp->st.real_fun && (nvflags&NV_STATIC)) || (!(flag&NV_EXPORT) && nv_isattr(np,(NV_EXPORT|NV_IMPORT))==(NV_EXPORT|NV_IMPORT)))))
-+				if(comvar || (shp->last_root==shp->var_tree && (tp->tp || (!shp->st.real_fun && (nvflags&NV_STATIC)) || (!(flag&(NV_EXPORT|NV_RDONLY)) && nv_isattr(np,(NV_EXPORT|NV_IMPORT))==(NV_EXPORT|NV_IMPORT)))))
- {
- 					_nv_unset(np,0);
- }
+ 				pw = &dummy;
++				pw->p_shp = sh_getinterp();
+ 				pw->p_pid = pid;
+ 				pw->p_pgrp = pid;
+ 			}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ksh93/patches/CR7033181.patch	Tue May 08 23:48:08 2012 +0100
@@ -0,0 +1,11 @@
+--- a/src/cmd/ksh93/bltins/typeset.c	Fri Dec 31 00:15:57 2010
++++ b/src/cmd/ksh93/bltins/typeset.c	Tue Jun 28 13:59:53 2011
[email protected]@ -608,7 +608,7 @@
+ 			}
+ 			if(!nv_isarray(np) && !strchr(name,'=') && !(shp->envlist  && nv_onlist(shp->envlist,name)))
+ 			{
+-				if(comvar || (shp->last_root==shp->var_tree && (tp->tp || (!shp->st.real_fun && (nvflags&NV_STATIC)) || (!(flag&NV_EXPORT) && nv_isattr(np,(NV_EXPORT|NV_IMPORT))==(NV_EXPORT|NV_IMPORT)))))
++				if(comvar || (shp->last_root==shp->var_tree && (tp->tp || (!shp->st.real_fun && (nvflags&NV_STATIC)) || (!(flag&(NV_EXPORT|NV_RDONLY)) && nv_isattr(np,(NV_EXPORT|NV_IMPORT))==(NV_EXPORT|NV_IMPORT)))))
+ {
+ 					_nv_unset(np,0);
+ }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ksh93/patches/CR7046434.patch	Tue May 08 23:48:08 2012 +0100
@@ -0,0 +1,13 @@
+diff -rupN INIT.2011-02-08/src/cmd/ksh93/sh/subshell.c INIT.2011-02-08.clean/src/cmd/ksh93/sh/subshell.c
+--- INIT.2011-02-08/src/cmd/ksh93/sh/subshell.c	2012-05-01 10:06:04.621554775 -0700
++++ INIT.2011-02-08.clean/src/cmd/ksh93/sh/subshell.c	2012-05-01 10:05:25.139965959 -0700
[email protected]@ -241,9 +241,6 @@ Namval_t *sh_assignok(register Namval_t 
+ 	/* don't bother with this */
+ 	if(!sp->shpwd || np==SH_LEVELNOD || np==L_ARGNOD || np==SH_SUBSCRNOD || np==SH_NAMENOD)
+ 		return(np);
+-	/* don't bother to save if in newer scope */
+-	if(sp->var!=shp->var_tree && shp->last_root==shp->var_tree)
+-		return(np);
+ 	if((ap=nv_arrayptr(np)) && (mp=nv_opensub(np)))
+ 	{
+ 		shp->last_root = ap->table;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ksh93/patches/CR7061011.patch	Tue May 08 23:48:08 2012 +0100
@@ -0,0 +1,12 @@
+diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/sh/nvdisc.c INIT.2011-02-08/src/cmd/ksh93/sh/nvdisc.c
+--- INIT.2011-02-08.clean/src/cmd/ksh93/sh/nvdisc.c	2012-05-02 03:46:22.725281017 -0700
++++ INIT.2011-02-08/src/cmd/ksh93/sh/nvdisc.c	2012-05-02 03:54:19.300127633 -0700
[email protected]@ -593,7 +593,7 @@ static char *setdisc(register Namval_t* 
+ 		action = vp->bltins[type];
+ 		vp->bltins[type] = 0;
+ 	}
+-	return(action?(char*)action:"");
++	return((char*)action);
+ }
+ 
+ static void putdisc(Namval_t* np, const char* val, int flag, Namfun_t* fp)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ksh93/patches/CR7089799.patch	Tue May 08 23:48:08 2012 +0100
@@ -0,0 +1,35 @@
+diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/sh/io.c INIT.2011-02-08/src/cmd/ksh93/sh/io.c
+--- INIT.2011-02-08.clean/src/cmd/ksh93/sh/io.c	2012-05-07 14:33:37.179788579 +0100
++++ INIT.2011-02-08/src/cmd/ksh93/sh/io.c	2012-05-07 14:39:11.089877123 +0100
[email protected]@ -868,10 +868,10 @@ int sh_iomovefd(register int fdold)
+ {
+ 	Shell_t *shp = sh_getinterp();
+ 	register int fdnew;
++	VALIDATE_FD(shp, fdold);
+ 	if(fdold<0 || fdold>2)
+ 		return(fdold);
+ 	fdnew = sh_iomovefd(dup(fdold));
+-	VALIDATE_FD(shp, fdold);
+ 	VALIDATE_FD(shp, fdnew);
+ 	shp->fdstatus[fdnew] = (shp->fdstatus[fdold]&~IOCLEX);
+ 	close(fdold);
[email protected]@ -890,6 +890,8 @@ int	sh_pipe(register int pv[])
+ 		errormsg(SH_DICT,ERROR_system(1),e_pipe);
+ 	pv[0] = sh_iomovefd(pv[0]);
+ 	pv[1] = sh_iomovefd(pv[1]);
++	VALIDATE_FD(shp, pv[0]);
++	VALIDATE_FD(shp, pv[1]);
+ 	shp->fdstatus[pv[0]] = IONOSEEK|IOREAD;
+ 	shp->fdstatus[pv[1]] = IONOSEEK|IOWRITE;
+ 	sh_subsavefd(pv[0]);
+diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/sh/path.c INIT.2011-02-08/src/cmd/ksh93/sh/path.c
+--- INIT.2011-02-08.clean/src/cmd/ksh93/sh/path.c	2012-05-07 14:33:37.182443770 +0100
++++ INIT.2011-02-08/src/cmd/ksh93/sh/path.c	2012-05-07 14:40:06.256096054 +0100
[email protected]@ -565,6 +565,7 @@ static int	path_opentype(Shell_t *shp,co
+ 	if(fd>=0 && (fd = sh_iomovefd(fd)) > 0)
+ 	{
+ 		fcntl(fd,F_SETFD,FD_CLOEXEC);
++		VALIDATE_FD(shp, fd);
+ 		shp->fdstatus[fd] |= IOCLEX;
+ 	}
+ 	return(fd);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ksh93/patches/MAP_TYPE_64_Bits.patch	Tue May 08 23:48:08 2012 +0100
@@ -0,0 +1,12 @@
+diff -rupN INIT.2011-02-08.clean/src/lib/libast/sfio/sfmode.c INIT.2011-02-08/src/lib/libast/sfio/sfmode.c
+--- INIT.2011-02-08.clean/src/lib/libast/sfio/sfmode.c	2012-05-07 15:45:04.418751281 +0100
++++ INIT.2011-02-08/src/lib/libast/sfio/sfmode.c	2012-05-07 15:49:09.326244280 +0100
[email protected]@ -400,7 +400,7 @@ reg int		local;	/* a local call */
+ 
+ 	if(f->mode&SF_GETR)
+ 	{	f->mode &= ~SF_GETR;
+-#ifdef MAP_TYPE
++#if defined(MAP_TYPE) && (_ptr_bits < 64)
+ 		if((f->bits&SF_MMAP) && (f->tiny[0] += 1) >= (4*SF_NMAP) )
+ 		{	/* turn off mmap to avoid page faulting */
+ 			sfsetbuf(f,(Void_t*)f->tiny,(size_t)SF_UNBOUND);