Lars Schneider
2018-08-19 19:12:07 UTC
Hi,
#!/bin/bash
[ "`whoami`" = "root" ] || {
}
read -s -p "enter stuff: " stuff
If I run the script as normal user (not root!) and I abort the "read -s -p"
call with "ctrl-c", then my shell is still in silent mode.
I can consitently replicate that behavior on Ubuntu 14.04.5 LTS (Trusty)
and BASH 4.3.11(1)-release (x86_64-pc-linux-gnu) as well as BASH 4.3.30.
I also installed BASH 4.4.18 from source and I can replicate the issue.
I did a mistake: The problem _was_ fixed with BASH 4.4.18.#!/bin/bash
[ "`whoami`" = "root" ] || {
}
read -s -p "enter stuff: " stuff
If I run the script as normal user (not root!) and I abort the "read -s -p"
call with "ctrl-c", then my shell is still in silent mode.
I can consitently replicate that behavior on Ubuntu 14.04.5 LTS (Trusty)
and BASH 4.3.11(1)-release (x86_64-pc-linux-gnu) as well as BASH 4.3.30.
I also installed BASH 4.4.18 from source and I can replicate the issue.
Further testing revealed that it is fixed with 4.4. too but not in Bash-4.3 patch 46.
oo. Fixed a bug that caused bash to not clean up readline's state, including
the terminal settings, if it received a fatal signal while in a readline()
call (including `read -e' and `read -s').
Does anyone see a workaround to set the readline state properly
for older BASH versions?
[ "`whoami`" = "root" ] || {
exec sudo -u root "$0" "$@"
}
function finish {
stty echo echok
}
trap finish EXIT
read -s -p "enter stuff: " stuff
echo "answer: $stuff"
Cheers,
Lars