diff --git a/NEWS b/NEWS index f9688def0ce9..d43ad7f2610e 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,12 @@ For full details, see the git log at: https://github.com/ksh93/ksh Any uppercase BUG_* names are modernish shell bug IDs. +2020-10-21: + +- Fixed: More concisely correct the exporting of uppercase and lowercase + variables when only the export and change case attributes were applied. + This fix improves upon the previous 2020-09-30 modifications. + 2020-10-06: - The security of virtual/non-forking subshells that locally change the present diff --git a/src/cmd/ksh93/bltins/typeset.c b/src/cmd/ksh93/bltins/typeset.c index eca594f462aa..280b994bb590 100644 --- a/src/cmd/ksh93/bltins/typeset.c +++ b/src/cmd/ksh93/bltins/typeset.c @@ -94,7 +94,6 @@ int b_readonly(int argc,char *argv[],Shbltin_t *context) memset((void*)&tdata,0,sizeof(tdata)); tdata.sh = context->shp; tdata.aflag = '-'; - tdata.argnum = -1; /* tell nv_newattr() that we should not change size */ while((flag = optget(argv,*command=='e'?sh_optexport:sh_optreadonly))) switch(flag) { case 'p': diff --git a/src/cmd/ksh93/include/version.h b/src/cmd/ksh93/include/version.h index 10bb1cec524d..1f4f74c00b61 100644 --- a/src/cmd/ksh93/include/version.h +++ b/src/cmd/ksh93/include/version.h @@ -17,4 +17,4 @@ * David Korn * * * ***********************************************************************/ -#define SH_RELEASE "93u+m 2020-10-06" +#define SH_RELEASE "93u+m 2020-10-21" diff --git a/src/cmd/ksh93/sh/name.c b/src/cmd/ksh93/sh/name.c index 11d87338b7e1..74f6cd6cc5e4 100644 --- a/src/cmd/ksh93/sh/name.c +++ b/src/cmd/ksh93/sh/name.c @@ -2938,28 +2938,29 @@ void nv_newattr (register Namval_t *np, unsigned newatts, int size) errormsg(SH_DICT,ERROR_exit(1),e_restricted,nv_name(np)); /* handle attributes that do not change data separately */ n = np->nvflag; - trans = !(n&NV_INTEGER) && (n&(NV_LTOU|NV_UTOL)); + trans = !(n&NV_INTEGER) && (n&(NV_LTOU|NV_UTOL)); /* transcode to lower or upper case */ if(newatts&NV_EXPORT) nv_offattr(np,NV_IMPORT); - if(((n^newatts)&NV_EXPORT)) + if(((n^newatts)&NV_EXPORT)) /* EXPORT attribute has been toggled */ { /* record changes to the environment */ - if(n&NV_EXPORT) + if(n&NV_EXPORT) { + /* EXPORT exists on old attributes therefore not on new */ nv_offattr(np,NV_EXPORT); env_delete(shp->env,nv_name(np)); } else - { + { + /* EXPORT is now turned on for new attributes */ nv_onattr(np,NV_EXPORT); sh_envput(shp->env,np); } - if((n^newatts)==NV_EXPORT && size==-1) + if((n^newatts)==NV_EXPORT && !trans) + /* Only EXPORT attribute has changed and thus all work has been done. */ return; } oldsize = nv_size(np); - if(size==-1) - size = oldsize; if((size==oldsize|| (n&NV_INTEGER)) && !trans && ((n^newatts)&~NV_NOCHANGE)==0) { if(size)