mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-02-24 06:54:13 +00:00
Hopefully this will deal with ksh crashing in macOS Terminal.app once and for all. Trigger: press Command-F to open the find bar, then press Esc to close it, then press Esc again. Result: crash somewhere random in the job control code. Turns out macOS Terminal.app apparently (and wrongly) sends <Esc> followed by <Ctrl+L> to the terminal, which ksh takes as a sequence for clearing the screen. The related crash ultimately traced back to the code for that in emacs.c. The other crash was in the code for double-ESC file name completion. This commit also fixes a non-robust invocation of the 'tput' command by using the direct path found in $(getconf PATH). src/cmd/ksh93/features/cmds: - Remove unused tests for the presence of commands (newgrp,test,id,wc,cut,logname,pfexec). - Replace 'cmd tput' test by 'pth tput' which will find its path in $(getconf PATH) and store that path as the macro value. - Add two tests to determine if 'tput' supports terminfo and/or termcap codes. (FreeBSD still requires old termcap codes.) src/cmd/ksh93/edit/emacs.c: escape(): - Fix a crash in the code for double-ESC completion. Check if the cursor is on a non-zero position; this caused a bus error (invalid address access) in the subsequent ed_expand call. - For <Esc><Ctrl+L> (clear screen), fix the strange crash in macOS Terminal by not using sh_trap() to invoke "tput clear", which causes ksh itself to invoke that command. ksh apparently doesn't cope with doing this while SIGWINCH (window size change signal) is sent by Terminal. The fix is to just use the C standard system(3) function to invoke tput. This invokes tput via /bin/sh, but what the hey. (Note that ksh also ran any function or alias called 'tput' instead of the real command, and that is now also fixed.) - Use the new _pth_tput test result to invoke tput with the hardcoded default system path, increasing robustness. src/cmd/ksh93/edit/edit.c: ed_setup(): - Use the new _pth_tput test result to invoke tput with the hardcoded default system path, increasing robustness. - When getting the escape code for "cursor up", use the new _tput_terminfo and _tput_termcap test results to determine which kind of command code to send. This fixes it on FreeBSD. |
||
---|---|---|
.. | ||
cmds | ||
dynamic | ||
externs | ||
locale | ||
math.sh | ||
options | ||
poll | ||
rlimits | ||
setjmp | ||
sigfeatures | ||
time | ||
ttys |