From: Jeff King <peff@peff.net>
To: Dmitry Potapov <dpotapov@gmail.com>
Cc: git@vger.kernel.org, Johannes Sixt <j6t@kdbg.org>,
Joey Hess <joey@kitenet.net>
Subject: Re: RFC: [PATCH] ignore SIGINT&QUIT while waiting for external command
Date: Tue, 19 Oct 2010 09:32:36 -0400 [thread overview]
Message-ID: <20101019133236.GA804@sigill.intra.peff.net> (raw)
In-Reply-To: <20101019115943.GA8065@dpotapov.dyndns.org>
On Tue, Oct 19, 2010 at 03:59:43PM +0400, Dmitry Potapov wrote:
> The solution is to disable SIGINT and SIGQUIT as it is normally done by
> system(). Disabling these signals is done only when silent_exec_failure
> is set, which means that the current process is used as a proxy to run
> another command.
I don't understand why we would only do it for silent_exec_failure. You
claim that flag means that the current process is a proxy for another
command, but:
1. Is that really the case, or do the two things just happen to
coincide in the current codebase?
2. Why do we want to do it only for the proxy-command case? If I have
a long-running external diff or merge helper, for example, what
should happen on SIGINT? Should we exit with the child still
potentially running, or should we actually be reaping the child
properly?
> + if (cmd->silent_exec_failure) {
> + sigint = signal(SIGINT, SIG_IGN);
> + sigquit = signal(SIGQUIT, SIG_IGN);
> + }
> cmd->pid = fork();
> if (!cmd->pid) {
> + if (cmd->silent_exec_failure) {
> + signal(SIGINT, sigint);
> + signal(SIGQUIT, sigquit);
> + }
How does this interact with the sigchain code? If I do:
start_command(...);
sigchain_push(...);
finish_command(...);
we will overwrite the function pushed in the sigchain_push with a stale
handler. I think you could just replace your signal() calls with:
sigchain_push(SIGINT, SIG_IGN);
...
sigchain_pop(SIGINT);
but I wonder if ignoring is necessarily the right thing. Shouldn't we
just reap the child and then run the signal handler that was there
before us? That means in general that we will continue to die via SIGINT
when we see SIGINT. With your patch, we will ignore it and (presumably)
end up dying with a return code indicated that the child had an error.
I think both of these things are not problems for executing dashed
externals. But as above, I am not sure that we should be limiting this
signal handling to those cases.
-Peff
next prev parent reply other threads:[~2010-10-19 13:32 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-19 4:53 git subcommand sigint gotcha Joey Hess
2010-10-19 9:55 ` Dmitry Potapov
2010-10-19 11:59 ` RFC: [PATCH] ignore SIGINT&QUIT while waiting for external command Dmitry Potapov
2010-10-19 13:32 ` Jeff King [this message]
2010-10-19 13:40 ` Jeff King
2010-10-19 19:16 ` Jonathan Nieder
2010-10-19 19:50 ` Jeff King
2010-10-19 21:06 ` Jakub Narebski
2010-10-19 21:07 ` Jonathan Nieder
2010-10-19 16:31 ` Dmitry Potapov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20101019133236.GA804@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=dpotapov@gmail.com \
--cc=git@vger.kernel.org \
--cc=j6t@kdbg.org \
--cc=joey@kitenet.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).