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


Groups > gnu.bash.bug > #11553

Re: SIGINT handling

Path csiph.com!xmission!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 Thu, 24 Sep 2015 07:01:23 +0100
Lines 67
Approved bug-bash@gnu.org
Message-ID <mailman.1701.1443074491.19560.bug-bash@gnu.org> (permalink)
References <20150918151439.GA16455@chaz.gmail.com> <55FDC8B4.4000505@case.edu> <20150919213101.GA4393@chaz.gmail.com> <56035164.30105@case.edu>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
X-Trace usenet.stanford.edu 1443074492 24552 208.118.235.17 (24 Sep 2015 06:01:32 GMT)
X-Complaints-To action@cs.stanford.edu
Cc bug-bash <bug-bash@gnu.org>
To Chet Ramey <chet.ramey@case.edu>
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=qHaENUgkuUVqT+Y2KId6Cn/uIhO1oN+qtr9yQuw7W0Q=; b=ZN9GeSxfwkqtUPQAtWQrAGQeXdCuN9h7sgHa+XA82Fld1/Y5Sah8mCqoJDpv3t00V+ CRsMGqbKsyaYMG1IFunImfBcacJc90Z70Jn/zaDxBsp1BKDNGDlzSDYxSUZpWeYlz5ec P1WWg4EJb+shZ4lYv9jvPWiOpLo0Vpyr5Qp0lNqtyRyl31DC74BzTcfokUXNn6w026gU EPLdmMgWftY4EX+wgRjDxKSMaZaraKzco1pEXLAM/r0mdhd68wnkth4+F91EVj0NhyBl 7ZH0Mjvs2AAT9Vwqeeup2QWJSkWOIvWuPoPtqsQe0K0GGCASKopeu3+rAgUYGOaIQUA8 LOjw==
X-Received by 10.194.189.235 with SMTP id gl11mr31479945wjc.68.1443074484585; Wed, 23 Sep 2015 23:01:24 -0700 (PDT)
Content-Disposition inline
In-Reply-To <56035164.30105@case.edu>
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::22a
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:11553

Show key headers only | View raw


2015-09-23 21:27:00 -0400, Chet Ramey:
> On 9/19/15 5:31 PM, Stephane Chazelas wrote:
> 
> > In case it was caused by some Debian patch, I recompiled the
> > code of 4.3.42 from gnu.org and the one from the devel branch on
> > the git repository (commit bash-20150911 snapshot) and still:
> > 
> > $ ./bash -c 'sh -c "trap exit INT; sleep 10; :"; echo hi'
> > ^Chi
> > $ ./bash -c 'sh -c "trap exit INT; sleep 10; :"; echo hi'
> > ^Chi
> > $ ./bash -c 'sh -c "trap exit INT; sleep 10; :"; echo hi'
> > ^C
> > $ ./bash -c 'sh -c "trap exit INT; sleep 10; :"; echo hi'
> > ^Chi
> > 
> > Sometimes (and the frequency of occurrences is erratic,
> > generally roughly 80% of "hi"s but at times, I don't see a "hi"
> > in a while), the "hi" doesn't show up. Note that I press ^C well
> > after sleep has started.
> 
> It would be nice to see a system call trace for this so we can check
> what's going on with the timing.

I don't have them logged but I did several tests in gdb
with "handle SIGINT nostop pass" and as I said before, 
Upon the test that sets child_caught_sigint, waitpid() has not
returned with EINTR and wait_sigint_received has been set.

If I break on the SIGINT handler, I see the call trace at the
return of the "syscall".

I can try and get you a call trace later today.

> 
> Can you reproduce this on anything other than Debian?  I'm wondering
> whether it's a Linux-4 kernel phenomenon.  Plus I don't have any
> Debian machines laying around.


It's hard to reproduce on an idle system. It's relatively easy
to reproduce on a busy one and if the "cmd" exits shortly after
receiving its SIGINT. I can reproduce on a Ubuntu 14.04 with an
older kernel (3.13). I can't reproduce on FreeBSD (in a VM
though).


cmd ==
#include <unistd.h>
main() {signal(2,_exit);pause();}

$ tar zcf - / >& /dev/null &
[1] 4417
$ tar zcf - / >& /dev/null &
[2] 4419
$ tar zcf - / >& /dev/null &
[3] 4421
$ bash -c './a.out; echo x'
^Cx
$ bash -c './a.out; echo x'
^C

Works on second attempt.

-- 
Stephane

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


Thread

Re: SIGINT handling Stephane Chazelas <stephane.chazelas@gmail.com> - 2015-09-24 07:01 +0100

csiph-web