1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-24 06:54:13 +00:00
cde/src/cmd/ksh93/features
Martijn Dekker 7ff6b73bdb emacs.c: fix 2 causes of crash
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.
2021-02-03 17:55:03 +00:00
..
cmds emacs.c: fix 2 causes of crash 2021-02-03 17:55:03 +00:00
dynamic Remove code related to long-dead 3DFS research project 2020-06-12 01:45:17 +02:00
externs Tweak and regress-test 'command -x' (re: 66e1d446) 2021-02-01 02:19:02 +00:00
locale Version: 2012-08-01-master 2016-01-11 15:54:23 -05:00
math.sh feature tests: signbit detection fix for ia64 2021-02-02 04:40:09 +00:00
options Disable SHOPT_PFSH in feature test (re: f089d799) 2021-01-18 06:11:45 +00:00
poll Remove vestigial 3DFS support code (re: f88f302c) 2020-07-17 05:04:03 +01:00
rlimits Build fix for Linux i386 2021-01-31 23:47:43 +00:00
setjmp Version: 2012-08-01-master 2016-01-11 15:54:23 -05:00
sigfeatures Version: 2012-08-01-master 2016-01-11 15:54:23 -05:00
time Fix the max precision of the 'time' keyword (#72) 2020-07-14 22:48:04 +01:00
ttys Version: 2012-08-01-master 2016-01-11 15:54:23 -05:00