diff --git a/NEWS b/NEWS index 349a90cf5..a4f4ea903 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,16 @@ For full details, see the git log at: https://github.com/ksh93/ksh Any uppercase BUG_* names are modernish shell bug IDs. +2021-12-09: + +- Increased the general robustness of discipline function handling, fixing + crashing bugs with PS2.get() and .sh.tilde.get() disciplines, among others. + +- Fixed a crash that occurred on the interactive shell if the PS1 prompt + contains multiple command substitutions and the user interrupts input + while the shell is on a PS2 prompt waiting for the user to complete a + command substitution of the form $( ... ). + 2021-12-08: - Fixed: if a function returned with a status > 256 using the 'return' command diff --git a/src/cmd/ksh93/include/version.h b/src/cmd/ksh93/include/version.h index 6c1ae927f..662c96448 100644 --- a/src/cmd/ksh93/include/version.h +++ b/src/cmd/ksh93/include/version.h @@ -21,7 +21,7 @@ #define SH_RELEASE_FORK "93u+m" /* only change if you develop a new ksh93 fork */ #define SH_RELEASE_SVER "1.0.0-beta.2" /* semantic version number: https://semver.org */ -#define SH_RELEASE_DATE "2021-12-08" /* must be in this format for $((.sh.version)) */ +#define SH_RELEASE_DATE "2021-12-09" /* must be in this format for $((.sh.version)) */ #define SH_RELEASE_CPYR "(c) 2020-2021 Contributors to ksh " SH_RELEASE_FORK /* Scripts sometimes field-split ${.sh.version}, so don't change amount of whitespace. */ diff --git a/src/cmd/ksh93/sh/fault.c b/src/cmd/ksh93/sh/fault.c index 502c7661e..b96e6b21a 100644 --- a/src/cmd/ksh93/sh/fault.c +++ b/src/cmd/ksh93/sh/fault.c @@ -68,6 +68,9 @@ void sh_fault(register int sig) register char *trap; register struct checkpt *pp = (struct checkpt*)shp->jmplist; int action=0; + /* reset lexer state on Ctrl+C */ + if(sh_isstate(SH_INTERACTIVE) && sig==SIGINT) + sh_lexopen(sh.lex_context, &sh, 0); /* reset handler */ if(!(sig&SH_TRAP)) signal(sig, sh_fault); diff --git a/src/cmd/ksh93/sh/lex.c b/src/cmd/ksh93/sh/lex.c index a887978f8..9136f45fd 100644 --- a/src/cmd/ksh93/sh/lex.c +++ b/src/cmd/ksh93/sh/lex.c @@ -2106,6 +2106,8 @@ noreturn void sh_syntax(Lex_t *lp) fcclose(); shp->inlineno = lp->inlineno; shp->st.firstline = lp->firstline; + /* reset lexer state */ + sh_lexopen(lp, &sh, 0); if(!sh_isstate(SH_INTERACTIVE) && !sh_isstate(SH_PROFILE)) errormsg(SH_DICT,ERROR_exit(SYNBAD),e_lexsyntax1,lp->lastline,tokstr,cp); else