63 lines
2.0 KiB
Plaintext
63 lines
2.0 KiB
Plaintext
--- src/cmd/ksh93/sh/array.c
|
|
+++ src/cmd/ksh93/sh/array.c 2011-05-20 12:42:14.555927664 +0000
|
|
@@ -410,7 +410,7 @@ static Namfun_t *array_clone(Namval_t *n
|
|
mq = 0;
|
|
if(nq=nv_opensub(np))
|
|
mq = nv_search(name,ap->table,NV_ADD);
|
|
- if(nq && (flags&NV_COMVAR) && nv_isvtree(nq))
|
|
+ if(nq && (((flags&NV_COMVAR) && nv_isvtree(nq)) || nv_isarray(nq)))
|
|
{
|
|
mq->nvalue.cp = 0;
|
|
if(!is_associative(ap))
|
|
@@ -458,6 +458,7 @@ static char *array_getval(Namval_t *np,
|
|
{
|
|
register Namarr_t *aq,*ap = (Namarr_t*)disc;
|
|
register Namval_t *mp;
|
|
+ register char *cp=0;
|
|
if((mp=array_find(np,ap,ARRAY_LOOKUP))!=np)
|
|
{
|
|
if(!mp && !is_associative(ap) && (aq=(Namarr_t*)ap->scope))
|
|
@@ -466,7 +467,12 @@ static char *array_getval(Namval_t *np,
|
|
if((mp=array_find(np,aq,ARRAY_LOOKUP))==np)
|
|
return(nv_getv(np,&aq->hdr));
|
|
}
|
|
- return(mp?nv_getval(mp):0);
|
|
+ if(mp)
|
|
+ {
|
|
+ cp = nv_getval(mp);
|
|
+ nv_offattr(mp,NV_EXPORT);
|
|
+ }
|
|
+ return(cp);
|
|
}
|
|
return(nv_getv(np,&ap->hdr));
|
|
}
|
|
@@ -667,7 +673,7 @@ static struct index_array *array_grow(Na
|
|
ap->header.hdr.dsize = sizeof(*ap) + i;
|
|
i = 0;
|
|
ap->header.fun = 0;
|
|
- if(nv_isnull(np) && nv_isattr(np,NV_NOFREE))
|
|
+ if((nv_isnull(np)|| np->nvalue.cp==Empty) && nv_isattr(np,NV_NOFREE))
|
|
{
|
|
i = ARRAY_TREE;
|
|
nv_offattr(np,NV_NOFREE);
|
|
@@ -1236,7 +1242,7 @@ void *nv_associative(register Namval_t *
|
|
for(;ap->cur=ap->pos; ap->pos=ap->nextpos)
|
|
{
|
|
ap->nextpos = (Namval_t*)dtnext(ap->header.table,ap->pos);
|
|
- if(ap->cur->nvalue.cp)
|
|
+ if(!nv_isnull(ap->cur))
|
|
{
|
|
if((ap->header.nelem&ARRAY_NOCHILD) && nv_isattr(ap->cur,NV_CHILD))
|
|
continue;
|
|
--- src/cmd/ksh93/sh/xec.c
|
|
+++ src/cmd/ksh93/sh/xec.c 2011-06-14 13:31:32.471925963 +0200
|
|
@@ -680,7 +680,7 @@ static int set_instance(Shell_t *shp,Nam
|
|
char *sp=0,*cp;
|
|
Namarr_t *ap;
|
|
Namval_t *np;
|
|
- if(!nv_isattr(nq,NV_MINIMAL|NV_EXPORT) && (np=(Namval_t*)nq->nvenv) && nv_isarray(np))
|
|
+ if(!nv_isattr(nq,NV_MINIMAL|NV_EXPORT|NV_ARRAY) && (np=(Namval_t*)nq->nvenv) && nv_isarray(np))
|
|
nq = np;
|
|
cp = nv_name(nq);
|
|
memset(nr,0,sizeof(*nr));
|