Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #11504

SIGINT handling

From Stephane Chazelas <stephane.chazelas@gmail.com>
Newsgroups gnu.bash.bug
Subject SIGINT handling
Date 2015-09-18 16:14 +0100
Message-ID <mailman.1355.1442589288.19560.bug-bash@gnu.org> (permalink)

Show all headers | View raw


Hello.

In:

bash -c 'sh -c "trap exit INT; sleep 10; :"; echo hi'

If I press Ctrl-C, I still see "hi".

On Solaris with 4.1.11(2)-release (i386-pc-solaris2.11), that
seems to be consistent.

On Debian with 4.3.42(1)-release (x86_64-pc-linux-gnu), that
seems to happen only in something like 80% of the time.

For bash to exit upon receiving that SIGINT, the currently
running process has to die itself as well of SIGINT (or the
currently running command to be builtin).

That sounds like a bad idea, especially considering that it
doesn't exit either if the process returns with exit code 130
upon receiving that SIGINT. For instance:

For instance, in:

bash -c 'mksh -c "sleep 10; :"; echo hi'

Upon pressing Ctrl-C, mksh handles the SIGINT and exits with
130 (as opposed to dying of a SIGINT), so bash doesn't exit
(sometimes only on Debian).

ksh93 seems to be doing something similar (even worse).
http://unix.stackexchange.com/a/230568/22565

Why? What's the rational behind that. It seems it's not
documented and contradicts the documentation.

-- 
Stephane

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

SIGINT handling Stephane Chazelas <stephane.chazelas@gmail.com> - 2015-09-18 16:14 +0100

csiph-web