Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 27ea54d1944161d254053cf33541290d > files > 11

ksh-20100621-5.el5_8.1.src.rpm

diff -up ksh-20100621/src/cmd/ksh93/bltins/typeset.c.arrayfix ksh-20100621/src/cmd/ksh93/bltins/typeset.c
--- ksh-20100621/src/cmd/ksh93/bltins/typeset.c.arrayfix	2011-07-26 15:04:39.612940206 +0200
+++ ksh-20100621/src/cmd/ksh93/bltins/typeset.c	2011-07-26 15:13:34.271564914 +0200
@@ -467,6 +467,7 @@ static int     b_common(char **argv,regi
 		{
 			register unsigned newflag;
 			register Namval_t *np;
+			Namarr_t *ap;
 			unsigned curflag;
 			if(troot == shp->fun_tree)
 			{
@@ -521,6 +522,12 @@ static int     b_common(char **argv,regi
 			np = nv_open(name,troot,nvflags|((nvflags&NV_ASSIGN)?0:NV_ARRAY));
 			if(nv_isnull(np) && nv_isattr(np,NV_NOFREE))
 				nv_offattr(np,NV_NOFREE);
+			if((ap=nv_arrayptr(np)) && nv_aindex(np)>0 && ap->nelem==1 && nv_getval(np)==Empty)
+			{
+				ap->nelem++;
+				_nv_unset(np,0);
+				ap->nelem--;
+			}
 			if(tp->pflag)
 			{
 				nv_attribute(np,sfstdout,tp->prefix,1);