On Mon, Jul 15, 2013 at 2:59 AM, David Korn <[email protected]> wrote:
> cc:  [email protected]    [email protected]
> Subject: Re: Re: [ast-users] ksh93 returns "()" for "${a[@]}" if I clear an 
> array  with a=( )
> --------
>
> Here is the patch:
>
> --- old/sh/name.c       Mon Jun 24 15:37:10 2013
> +++ new/sh/name.c       Thu Jul 11 13:50:50 2013
> @@ -455,7 +457,14 @@
>                                 if(tp->tre.tretyp==0 && !tp->com.comset && 
> !tp->com.comarg)
>                                 {
>                                         if(!(arg->argflag&ARG_APPEND) && 
> nv_isattr(np,NV_BINARY|NV_NOFREE|NV_RAW)!=(NV_BINARY|NV_NOFREE|NV_RAW))
> +                                       {
> +                                               array = nv_isarray(np);
>                                                 _nv_unset(np,NV_EXPORT);
> +                                               if(ap && ap->fun)
> +                                                       
> nv_setarray(np,nv_associative);
> +                                               else if(ap || array)
> +                                                       
> nv_onattr(np,NV_ARRAY);
> +                                       }
>                                         goto skip;
>                                 }
>                                 if(tp->tre.tretyp==TLST || !tp->com.comset || 
> tp->com.comset->argval[0]!='[')

Erm... the patch doesn't seem to work for arrays of user-defined types:
-- snip --
$ ksh -c 'typeset -T x_t=( integer i=1 ) ; compound c=( x_t -a ar=(
(i=2) (i=3) ) ); c.ar=( ) ; print -v c'
(
        x_t -a ar=(
                [0]=(
                        typeset -l -i i=2
                )
                [1]=(
                        typeset -l -i i=3
                )
        )
)
-- snip --
... AFAIK it should print:
-- snip --
(
        x_t -a ar
)
-- snip --

Same applies to 4D indexed arrays of user-defined types...

----

Bye,
Roland

-- 
  __ .  . __
 (o.\ \/ /.o) [email protected]
  \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
  /O /==\ O\  TEL +49 641 3992797
 (;O/ \/ \O;)
_______________________________________________
ast-developers mailing list
[email protected]
http://lists.research.att.com/mailman/listinfo/ast-developers

Reply via email to