From b12be093d72a50236fdeb35a68c4504099844db4 Mon Sep 17 00:00:00 2001 From: Martijn Dekker Date: Tue, 2 Feb 2021 14:31:35 +0000 Subject: [PATCH] typeset: print_value(): save/restore last_table This fix comes via an OpenSUSE patch but also exists in 93v- beta. https://build.opensuse.org/package/view_file/shells/ksh/ksh93-typedef.dif (only the printvalue() diff was still applicable to 93u+m; the setall() fix was done differently and better in a2f13c19) --- src/cmd/ksh93/bltins/typeset.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/cmd/ksh93/bltins/typeset.c b/src/cmd/ksh93/bltins/typeset.c index cc5987fab990..fdc685f57062 100644 --- a/src/cmd/ksh93/bltins/typeset.c +++ b/src/cmd/ksh93/bltins/typeset.c @@ -500,6 +500,7 @@ static void print_value(Sfio_t *iop, Namval_t *np, struct tdata *tp) { char *name; int aflag=tp->aflag; + Namval_t *table; if(nv_isnull(np)) { if(!np->nvflag) @@ -543,7 +544,9 @@ static void print_value(Sfio_t *iop, Namval_t *np, struct tdata *tp) sfwrite(iop,"}\n",2); return; } + table = tp->sh->last_table; sfputr(iop,nv_name(np),aflag=='+'?'\n':'='); + tp->sh->last_table = table; if(aflag=='+') return; if(nv_isarray(np) && nv_arrayptr(np))