[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
read -e does not restore terminal settings correctly when interrupted if
From: |
mickael9 |
Subject: |
read -e does not restore terminal settings correctly when interrupted if a trap is set |
Date: |
Mon, 8 Sep 2014 00:40:46 +0200 (CEST) |
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-unknown-linux-gnu'
-DCONF_VENDOR='unknown' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash'
-DSHELL -DHAVE_CONFIG_H -I. -I. -I./include -I./lib
-DDEFAULT_PATH_VALUE='/usr/local/sbin:/usr/local/bin:/usr/bin'
-DDEFAULT_PATH_VALUE='/usr/local/sbin:/usr/local/bin:/usr/bin'
uname output: Linux mickael-laptop 3.16.1-1-ARCH #1 SMP PREEMPT Thu Aug 14
07:40:19 CEST 2014 x86_64 GNU/Linux
Machine Type: x86_64-unknown-linux-gnu
Bash Version: 4.3
Patch Level: 24
Release Status: release
Description:
Given the following script (test.sh) :
#!/bin/bash
cleanup() { :; }
trap cleanup 0
read -e dummy
Run the script ('bash test.sh') *in ZSH* and when it waits for an input,
interrupt it with Ctrl-C.
Your terminal is now messed-up. This can be verified by running 'cat
-t' and
pressing Enter. ^M will be printed instead of a newline and password
prompts such
as the one in sudo cannot be submitted by pressing Enter anymore.
I don't know whether this is caused by ZSH or bash, but using git
bisect on
bash reveals that the problem was introduced by this commit :
http://git.savannah.gnu.org/cgit/bash.git/commit/?id=9b86eb22c434c8848c9d592cba32d7e8fdf61459
Please also note that the bug does NOT happen if the trap is not
installed
(trap cleanup 0). There is definitely something strange going on.
Original issue : https://github.com/archlinuxfr/yaourt/issues/11
- read -e does not restore terminal settings correctly when interrupted if a trap is set,
mickael9 <=