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


Groups > gnu.bash.bug > #11561

Re: SIGINT handling

Path csiph.com!au2pb.net!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!peer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!nntp.club.cc.cmu.edu!169.228.66.3.MISMATCH!ihnp4.UCSD.Edu!usenet.stanford.edu!not-for-mail
From Chet Ramey <chet.ramey@case.edu>
Newsgroups gnu.bash.bug
Subject Re: SIGINT handling
Date Thu, 24 Sep 2015 16:06:15 -0400
Lines 38
Approved bug-bash@gnu.org
Message-ID <mailman.1758.1443125188.19560.bug-bash@gnu.org> (permalink)
References <20150918151439.GA16455@chaz.gmail.com> <55FDC8B4.4000505@case.edu> <20150919213101.GA4393@chaz.gmail.com> <55FE0BB8.8040500@case.edu> <20150920155219.GA8614@chaz.gmail.com> <20150920161245.GA14980@chaz.gmail.com> <20150920194542.GB14980@chaz.gmail.com> <560054CE.6000208@case.edu> <20150921210755.GC5598@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 1443125188 3493 208.118.235.17 (24 Sep 2015 20:06:28 GMT)
X-Complaints-To action@cs.stanford.edu
Cc bug-bash <bug-bash@gnu.org>, chet.ramey@case.edu
To Stephane Chazelas <stephane.chazelas@gmail.com>
Envelope-to bug-bash@gnu.org
X-Enigmail-Draft-Status N1110
User-Agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Thunderbird/38.2.0
In-Reply-To <20150921210755.GC5598@chaz.gmail.com>
X-Junkmail-Status score=10/60, host=mpv6.cwru.edu
X-Junkmail-Whitelist YES (by domain whitelist at mpv1.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.36
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>
X-Received-Bytes 3745
X-Received-Body-CRC 2199406549
Xref csiph.com gnu.bash.bug:11561

Show key headers only | View raw


On 9/21/15 5:07 PM, Stephane Chazelas wrote:

> The problem is that here the parent's SIGINT handler is run upon
> the return from waitpid(), just after. My patch doesn't rely on
> EINTR from waitpid() (which doesn't happen here, waitpid() returns
> with the pid of the child that did an exit() upon receiving
> SIGINT), just on the "status" returned by the child, so doesn't
> have the problem.

I wonder if the kernel is restarting the waitpid() even though the
signal handler was installed without SA_RESTART.

> What do you suggest we do to fix that issue?

I think your additional test for wait_sigint_received coupled with a
check that the child died for some other reason than SIGINT, in addition
to the EINTR test, is a reasonable fix.

>> This still counts as catching and handling the SIGINT, and the shell
>> should not act as if the foreground process died as a result of one.
> 
> That's the point I'm arguing on.
> 
> If the command handled SIGINT and returned with 130, I argue it
> is considering itself and telling its parent as having been
> "interrupted"

No, it's not.  If a shell exits with status 130, it's saying that the last
command it executed was killed by SIGINT, or happened to exit with status
130 for some random reason.  It's very possible for a non-interactive
shell to restore its original SIGINT handler and resend SIGINT to itself,
if it's concerned about telling its parent that it's been interrupted.

-- 
``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/

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


Thread

Re: SIGINT handling Chet Ramey <chet.ramey@case.edu> - 2015-09-24 16:06 -0400

csiph-web