diff --git a/src/cmd/ksh93/data/builtins.c b/src/cmd/ksh93/data/builtins.c index 4bb770404..1345dd56d 100644 --- a/src/cmd/ksh93/data/builtins.c +++ b/src/cmd/ksh93/data/builtins.c @@ -153,6 +153,10 @@ const struct shtable3 shtab_builtins[] = #if !_std_malloc && !_AST_std_malloc CMDLIST(vmstate) #endif +#if !_AST_ksh_release + /* The pty.sh regression tests need the stty builtin */ + CMDLIST(stty) +#endif #endif #if SHOPT_REGRESS "__regress__", NV_BLTIN|BLT_ENV, bltin(__regress__), diff --git a/src/cmd/ksh93/tests/pty.sh b/src/cmd/ksh93/tests/pty.sh index bcd7ab49b..89e6a1bdb 100755 --- a/src/cmd/ksh93/tests/pty.sh +++ b/src/cmd/ksh93/tests/pty.sh @@ -39,20 +39,23 @@ function err_exit } alias err_exit='err_exit $lineno' +alias warning='err\_exit $((Errors--,LINENO)) warning:' Command=${0##*/} integer Errors=0 lineno=1 [[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; } -whence -q pty || { err\_exit "$LINENO" "pty command not found -- tests skipped"; exit 0; } +whence -q pty || { warning "pty command not found -- tests skipped"; exit 0; } -# On FreeBSD, the OS-provided stty command does not appear to work correctly on a pty pseudoterminal. -# To avoid a couple of false regressions, we have to set 'erase' and 'kill' on the real terminal. +# On FreeBSD, or if there is no tty, the OS-provided stty command does not appear to work correctly on a pty pseudoterminal. +# To avoid false regressions, we have to either use the stty builtin, or set 'erase' and 'kill' on the real terminal. if builtin stty 2>/dev/null -then PATH=/opt/ast/bin:$PATH +then PATH=/opt/ast/bin:$PATH # virtual path for ksh path-bound builtins, so child shells use the stty builtin elif test -t 1 2>/dev/null 1>/dev/tty && stty_restore=$(stty -g) then trap 'stty "$stty_restore"' EXIT # note: on ksh, the EXIT trap is also triggered for termination due to a signal stty erase ^H kill ^X +else warning "cannot set tty state -- tests skipped" + exit 0 fi bintrue=$(whence -p true)