[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: SIGINT kills interactive shell from dot script
From: |
Chet Ramey |
Subject: |
Re: SIGINT kills interactive shell from dot script |
Date: |
Sun, 6 Nov 2016 11:52:04 -0500 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 |
On 11/6/16 4:08 AM, Martijn Dekker wrote:
> An interactive bash is killed by SIGINT after a command to unset any
> trap for SIGINT.
>
> $ cat >/tmp/dotscript <<EOF
> trap
> trap - INT
> kill -s INT "$$"
> EOF
> $ . /tmp/dotscript
> (no output of 'trap')
> (interactive shell exits)
You're on a roll finding long-lived bugs this week. This behavior has
been there for at least 20 years (I stopped looking when I got to 1995).
It should be an easy thing to change.
> Interestingly, the shell does not exit without the "trap - INT",
> although no trap was set for INT to begin with (as shown by the empty
> output of "trap").
It looks like the shell interpreted "reset to the default value" a little
too literally in this particular case.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/