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


Groups > gnu.bash.bug > #11506

Re: SIGINT handling

Path csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!usenet.stanford.edu!not-for-mail
From Stephane Chazelas <stephane.chazelas@gmail.com>
Newsgroups gnu.bash.bug
Subject Re: SIGINT handling
Date Sat, 19 Sep 2015 21:36:28 +0100
Lines 50
Approved bug-bash@gnu.org
Message-ID <mailman.1411.1442694995.19560.bug-bash@gnu.org> (permalink)
References <20150918151439.GA16455@chaz.gmail.com>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
X-Trace usenet.stanford.edu 1442694996 3106 208.118.235.17 (19 Sep 2015 20:36:36 GMT)
X-Complaints-To action@cs.stanford.edu
Cc Jilles Tjoelker <jilles@stack.nl>
To bug-bash <bug-bash@gnu.org>
Envelope-to bug-bash@gnu.org
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=RW27GG26/ZFF4DaQ2sgoipSoGAy9ZrwWODHc+eAKyPE=; b=GBH55l2N7v8ywpKsxMwKg/63zljIKH1hR187YK8Zm5knWXh8mOFm4LNQav6Ymz8tyy J7Qj3mv2p8fmD2QDU7EYtMzp2syn33NXgMHSLRsl9/TyApM66vElESoa/fvMfQGPqkhc 0jzXqzmYfh8ZLcgO6poeXwuxFlQDceFCMYmCLliRLl/KQ7QG3F9c75nf3cnP0B29OZjG 76W7F9BlINxsn/elYhPmLTvggXmb+sx50qQrH3Ae8d1UmD4lx2sYVfsxAA8FWWkujKPH 0wFcRESU+IsIEeAj7UfyVtiuBD4FZQB8zAiiDdBODcT4NAyLod1aP4DDbkt9Ft4bmVTm UyNg==
X-Received by 10.180.37.133 with SMTP id y5mr4851179wij.15.1442694989789; Sat, 19 Sep 2015 13:36:29 -0700 (PDT)
Content-Disposition inline
In-Reply-To <20150918151439.GA16455@chaz.gmail.com>
User-Agent Mutt/1.5.21 (2010-09-15)
X-detected-operating-system by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value).
X-Received-From 2a00:1450:400c:c05::22d
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.14
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <http://lists.gnu.org/archive/html/bug-bash>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
Xref csiph.com gnu.bash.bug:11506

Show key headers only | View raw


2015-09-18 16:14:39 +0100, Stephane Chazelas:
[...]
> In:
> 
> bash -c 'sh -c "trap exit INT; sleep 10; :"; echo hi'
> 
> If I press Ctrl-C, I still see "hi".
[...]

Jilles provided with the explanation at
http://unix.stackexchange.com/a/230731

with a link to:
http://www.cons.org/cracauer/sigint.html

Which makes sense.

Now, IMO a few things could be improved:

1- it would be nice if it could be clearly documented

2- if the shell received SIGINT, then I'd argue the currently
running process returning with a "status" such that
WIFEXITED(status)&& WEXITSTATUS(status) == SIGINT + 0200
should be another case where bash (and AT&T ksh and FreeBSD sh)
should exit as well (by killing themselves with SIGINT or
exit(SIGINT + 0200)).

That's my:

> 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).

3. There still seems to be a bug in bash in that

> 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.

Cheers,
Stephane

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


Thread

Re: SIGINT handling Stephane Chazelas <stephane.chazelas@gmail.com> - 2015-09-19 21:36 +0100

csiph-web