Path: csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!usenet.stanford.edu!not-for-mail From: Chet Ramey Newsgroups: gnu.bash.bug Subject: Re: SIGINT handling Date: Sat, 19 Sep 2015 16:42:28 -0400 Organization: ITS, Case Western Reserve University Lines: 42 Approved: bug-bash@gnu.org Message-ID: References: <20150918151439.GA16455@chaz.gmail.com> Reply-To: chet.ramey@case.edu NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Trace: usenet.stanford.edu 1442695357 3281 208.118.235.17 (19 Sep 2015 20:42:37 GMT) X-Complaints-To: action@cs.stanford.edu Cc: chet.ramey@case.edu To: Stephane Chazelas , bug-bash Envelope-to: bug-bash@gnu.org User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 In-Reply-To: <20150918151439.GA16455@chaz.gmail.com> X-Junkmail-Whitelist: YES (by domain whitelist at mpv2.tis.cwru.edu) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 129.22.105.37 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com gnu.bash.bug:11507 On 9/18/15 11:14 AM, Stephane Chazelas wrote: > 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). I'm surprised you've managed to avoid the dozen or so discussions on the topic. http://lists.gnu.org/archive/html/bug-bash/2014-03/msg00108.html Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/