[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: read -e does not restore terminal settings correctly when interrupte
From: |
Chet Ramey |
Subject: |
Re: read -e does not restore terminal settings correctly when interrupted if a trap is set |
Date: |
Mon, 08 Sep 2014 14:46:25 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 |
On 9/7/14, 6:40 PM, address@hidden wrote:
> 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.
Thanks for the report. The problem is that bash doesn't clean up readline
and its terminal state in all cases that can result in its calling
longjmp() or exiting the shell. I've attached a patch that should fix the
problem.
The problem doesn't manifest itself in bash because bash saves the terminal
state before a command runs and restores it when the command is terminated
by a signal.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU address@hidden http://cnswww.cns.cwru.edu/~chet/
term-cleanup.patch
Description: Source code patch