This change fixes a crash that can occur after setting a KEYBD trap then inputting a multi-line command substitution. The crash is similar to issue #347, but it's easier to reproduce since it doesn't require you to setup a kshrc file. Reproducer for the crash: $ ENV=/./dev/null ksh $ trap : KEYBD $ : $( > true) Memory fault(coredump) The bugfix was backported (with considerable changes) from ksh93v- 2013-10-08. The crash was first reported on the old mailing list: https://www.mail-archive.com/ast-users@lists.research.att.com/msg00313.html src/cmd/ksh93/{include/shlex.h,sh/lex.c}: - To fix this properly, we need sizeof(Lex_t) to work as expected in edit.c, but that is thwarted by the _SHLEX_PRIVATE macro in lex.c which shlex.h uses to add private structs to the Lex_t type in lex.c only. So get rid of that _SHLEX_PRIVATE macro and make those members part of the centrally defined struct, renaming them to make it clear they're considered private to lex.c. src/cmd/ksh93/edit/edit.c: - Now that we can get its size, save and restore the shell lexing context when a KEYBD trap is present. src/cmd/ksh93/tests/pty.sh: - Add a regression test for the KEYBD trap crash. Co-authored-by: Martijn Dekker <martijn@inlv.org> |
||
|---|---|---|
| .. | ||
| cmd | ||
| lib | ||
| Mamfile | ||