diff --git a/src/cmd/ksh93/sh/name.c b/src/cmd/ksh93/sh/name.c index 4a0b0667c4fc..7e4487a9a99d 100644 --- a/src/cmd/ksh93/sh/name.c +++ b/src/cmd/ksh93/sh/name.c @@ -2966,11 +2966,10 @@ void nv_newattr (register Namval_t *np, unsigned newatts, int size) nv_onattr(np,NV_EXPORT); sh_envput(shp->env,np); } - if((n^newatts)==NV_EXPORT && !trans) - /* Only EXPORT attribute has changed and thus all work has been done. */ - return; } oldsize = nv_size(np); + if(((n^newatts) & ~(NV_EXPORT|NV_RDONLY))==0) + size = oldsize; if((size==oldsize|| (n&NV_INTEGER)) && !trans && ((n^newatts)&~NV_NOCHANGE)==0) { if(size>0) diff --git a/src/cmd/ksh93/tests/attributes.sh b/src/cmd/ksh93/tests/attributes.sh index 064b0e33a836..5e92634b8b51 100755 --- a/src/cmd/ksh93/tests/attributes.sh +++ b/src/cmd/ksh93/tests/attributes.sh @@ -526,16 +526,16 @@ typeset -A expect=( [F12]='typeset -x -r -F 12 foo' [H]='typeset -x -r -H foo' [L]='typeset -x -r -L 0 foo' -# [L17]='typeset -x -r -L 17 foo' # TODO: outputs '-L 0' + [L17]='typeset -x -r -L 17 foo' [Mtolower]='typeset -x -r -l foo' [Mtoupper]='typeset -x -r -u foo' [R]='typeset -x -r -R 0 foo' -# [R17]='typeset -x -r -R 17 foo' # TODO: outputs '-L 0' + [R17]='typeset -x -r -R 17 foo' [X17]='typeset -x -r -X 17 foo' [S]='typeset -x -r foo' [T]='typeset -x -r foo' [Z]='typeset -x -r -Z 0 -R 0 foo' -# [Z13]='typeset -x -r -Z 13 -R 13 foo' # TODO: outputs 'typeset -x -r -Z 0 -R 0 foo' + [Z13]='typeset -x -r -Z 13 -R 13 foo' ) for flag in "${!expect[@]}" do unset foo