17432413 Infinite /bin/sh exec loop in ksh93 s11-update
authorTomas Klacko <tomas.klacko@oracle.com>
Tue, 14 Jan 2014 06:09:16 -0800
branchs11-update
changeset 2895 8e90a6f0b109
parent 2894 084b9f7b0aa4
child 2896 b798978a2c60
17432413 Infinite /bin/sh exec loop in ksh93
components/ksh93/Makefile
components/ksh93/patches/17432413.patch
--- a/components/ksh93/Makefile	Mon Jan 13 23:01:50 2014 -0800
+++ b/components/ksh93/Makefile	Tue Jan 14 06:09:16 2014 -0800
@@ -18,7 +18,7 @@
 #
 # CDDL HEADER END
 #
-# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
 #
 
 include ../../make-rules/shared-macros.mk
@@ -76,7 +76,8 @@
 					 CR7168611.patch CR7178717.patch \
 					 CR7175995.patch CR7128313.patch \
 					 Bug15794787,15819673.patch \
-					 Bug15808407.patch Bug17714341.patch
+					 Bug15808407.patch Bug17714341.patch \
+					 17432413.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/17432413.patch	Tue Jan 14 06:09:16 2014 -0800
@@ -0,0 +1,23 @@
+--- a/src/cmd/ksh93/sh/init.c
++++ b/src/cmd/ksh93/sh/init.c
[email protected]@ -720,7 +720,7 @@ static char* get_lastarg(Namval_t* np, Namfun_t *fp)
+ 	char	*cp;
+ 	int	pid;
+         if(sh_isstate(SH_INIT) && (cp=shp->lastarg) && *cp=='*' && (pid=strtol(cp+1,&cp,10)) && *cp=='*')
+-		nv_putval(np,(pid==shp->gd->ppid?cp+1:0),0);
++		nv_putval(np,cp+1,0);
+ 	return(shp->lastarg);
+ }
+ 
+--- a/src/cmd/ksh93/sh/main.c
++++ b/src/cmd/ksh93/sh/main.c
[email protected]@ -298,7 +298,7 @@ int sh_main(int ac, char *av[], Shinit_f userinit)
+ 					 */
+ 					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)))
++					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);
+ 						/*  exec to change $0 for ps */
+