From: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
To: phillip.wood@dunelm.org.uk
Cc: Jeff King <peff@peff.net>,
Phillip Wood via GitGitGadget <gitgitgadget@gmail.com>,
git@vger.kernel.org,
Johannes Schindelin <Johannes.Schindelin@gmx.de>,
Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH] rebase -i: ignore signals when forking subprocesses
Date: Mon, 11 Sep 2023 12:32:23 +0200 [thread overview]
Message-ID: <ZP7st70/G3kLujHG@ugly> (raw)
In-Reply-To: <a37a0f11-0723-4964-a187-54d960615d79@gmail.com>
On Mon, Sep 11, 2023 at 11:14:31AM +0100, Phillip Wood wrote:
>On 11/09/2023 11:00, Phillip Wood wrote:
>> There is an inevitable race between wait() returning and calling
>> signal() to restore the handlers for SIGINT and SIGQUIT,
>
>In principle if we installed a signal handler to set a flag if a signal
>is received while calling wait() and then once wait() returns
>successfully see if the child was killed we can tell if the signal was
>received while the child was alive.
>
yes, this is what i was already writing:
my point is that you shouldn't be doing that in the first place.
install the handlers when the sequencer is entered and leave them there.
the handlers need to set (volatile) flag variables, which are checked by
the sequencer on a regular basis.
a few notes on that:
- install without SA_RESTART, so syscalls can actually return with EINTR
and give us the opportunity to check the flag.
- an alternative to setting flags is setjmp()/longjmp(), but you really
don't want to go there.
- install with SA_RESETHAND, so the second ctrl-c will kill git
regardless, providing an escape hatch.
>In practice if the child is catching SIGINT or SIGQUIT we cannot rely
>on it re-raising the signal so that wont work.
>
yes, but that's a minor issue, i think.
by far most hooks and other things that might be invoked within
sequencer context don't mess with signals in the first place.
the things that do should be presumed to do the right thing, which means
at least a non-zero exit status in case of a premature termination,
which will yield pretty much the same effect on our side anyway.
so the only actually problematic situation would be us completely
ignoring the exit code (like the git-gc call, but that's clearly a bug
in git, and we control both sides, so it's easily fixable).
regards
next prev parent reply other threads:[~2023-09-11 23:02 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-07 10:03 [PATCH] rebase -i: ignore signals when forking subprocesses Phillip Wood via GitGitGadget
2023-09-07 12:57 ` Johannes Schindelin
2023-09-08 10:02 ` Phillip Wood
2023-09-10 8:24 ` Johannes Schindelin
2023-09-07 21:06 ` Jeff King
2023-09-08 9:59 ` Phillip Wood
2023-09-08 13:11 ` Phillip Wood
2023-09-10 10:05 ` Oswald Buddenhagen
2023-09-11 10:00 ` Phillip Wood
2023-09-11 10:14 ` Phillip Wood
2023-09-11 10:32 ` Oswald Buddenhagen [this message]
2023-09-13 15:33 ` Phillip Wood
2023-09-13 16:40 ` Oswald Buddenhagen
2023-09-14 9:56 ` Jeff King
2023-09-14 13:50 ` Phillip Wood
2023-09-07 21:16 ` Junio C Hamano
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=ZP7st70/G3kLujHG@ugly \
--to=oswald.buddenhagen@gmx.de \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
--cc=phillip.wood@dunelm.org.uk \
/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).