diff --git a/NEWS b/NEWS index 4527ae87577f..d5613710259b 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,13 @@ This documents significant changes in the 1.0 branch of ksh 93u+m. For full details, see the git log at: https://github.com/ksh93/ksh/tree/1.0 Uppercase BUG_* IDs are shell bug IDs as used by the Modernish shell library. +2025-01-05: + +- Fixed a crash that could occur if a discipline function was first assigned + to a variable in a virtual subshell before the variable was scoped to that + subshell, then upon subshell completion another discipline function of the + same type was assigned to that selfsame variable in the parent shell. + 2025-01-03: - The performance of virtual subshells has been significantly improved by diff --git a/src/cmd/ksh93/include/version.h b/src/cmd/ksh93/include/version.h index 85baf3d9fa07..98c7dbe03ae6 100644 --- a/src/cmd/ksh93/include/version.h +++ b/src/cmd/ksh93/include/version.h @@ -18,7 +18,7 @@ #include #include "git.h" -#define SH_RELEASE_DATE "2025-01-03" /* must be in this format for $((.sh.version)) */ +#define SH_RELEASE_DATE "2025-01-05" /* must be in this format for $((.sh.version)) */ /* * This comment keeps SH_RELEASE_DATE a few lines away from SH_RELEASE_SVER to avoid * merge conflicts when cherry-picking dev branch commits onto a release branch. diff --git a/src/cmd/ksh93/sh/xec.c b/src/cmd/ksh93/sh/xec.c index f935e5d0ce99..7ca61f4d3ffa 100644 --- a/src/cmd/ksh93/sh/xec.c +++ b/src/cmd/ksh93/sh/xec.c @@ -2325,7 +2325,14 @@ int sh_exec(const Shnode_t *t, int flags) if(npv) { if(!sh.mktype) + { /* + * Set the discipline function. If this is done in a subshell, the variable + * must be scoped to the subshell before nvfun is set to the discipline. + */ + if(sh.subshell && !sh.subshare) + sh_assignok(npv, 1); cp = nv_setdisc(npv,cp,np,(Namfun_t*)npv); + } if(!cp) { errormsg(SH_DICT,ERROR_exit(1),e_baddisc,fname);