Open dag-erling opened 6 months ago
visudo was messing up my term session until i added this fix for root. it also messed up nested commands that required reading from the tty which scripts do.
(fyi, correct issue reference for the default setting is #258)
to also capture a potential use_pty bug, i had to unset this for root b/c i was doing a nested command that read from the tty that no longer waited for input and just went on.
# using bash
# works as expected
$ printf '<%s>\n' "$(read -rp 'type something: ' var && printf %s $var)"
type something: foo
<foo>
$
# fails w/ use_pty on or off
$ printf '<%s>\n' "$(sudo read -rp 'type something: ' var && printf %s $var)"
read[9]: read: no query process
<>
$
The
use_pty
option was recently turned on by default (cf. #358). While this makes sense when for non-root target users, it does not make sense for root, and it breaks typeahead in the extremely common case of using sudo to run adminstrative commands interactively in a terminal. Please turn it off for root, either in code or by adding the following line to the defaultsudoers
file: