From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: Adrian Ratiu <adrian.ratiu@collabora.com>,
rsbecker@nexbridge.com, git@vger.kernel.org
Subject: Re: [PATCH] run_processes_parallel(): fix order of sigpipe handling
Date: Thu, 09 Apr 2026 06:40:22 -0700 [thread overview]
Message-ID: <xmqqo6jsw8u1.fsf@gitster.g> (raw)
In-Reply-To: <20260408234236.GA2980392@coredump.intra.peff.net> (Jeff King's message of "Wed, 8 Apr 2026 19:42:36 -0400")
Jeff King <peff@peff.net> writes:
>> Currently neither subprocess is marked with the clean-on-exit bit.
>> but if somebody is careless and flips the bit for these
>> subprocesses, start_command() will call mark_child_for_cleanup() and
>> causes sigchain_push_common() to set up cleanup_children_on_signal()
>> to be called, which would lead to a very similar bug.
>
> Hmm, good catch. This is a bit worrisome, as we've added some
> clean_on_exit calls recently, and might do so again.
>
>> I wonder if swapping the order of start_command() and sigchain_push()
>> in these two code paths have downsides, or is it making the code worse
>> just to futureproof it against a future that is unlikely to come?
>
> I don't think it's really making the code worse. It's putting the
> SIGPIPE handling closer to where we're actually doing the writes. But I
> don't like that it is a subtle thing that people writing new code have
> to worry about. And I wouldn't be surprised if there are other cases
> where we disable SIGPIPE, and then call start_command() in a much lower
> level of the call chain, which would make reordering harder.
OK. Such a change is easy, compared to anything we try to do better
;-).
> I wonder if we can do better.
>
> The root of the issue is that sigchain_push_common() is not really
> expressing what we want. We are trying to install a handler to do
> cleanup _if_ we are about to exit. And that is always going to be true
> for SIGTERM, etc, where we might install handlers but never expect them
> to rescue us from exiting. But for SIGPIPE, our desired action is really
> dependent on whether the signal is being ignored in general.
Hmph, I actually was hoping that we do not have to go in the route
that each specific signal differently, but I guess it is unavoidable
as they come with their own semantics (somewhat similar to the way
how their default disposition has to be different).
> That's a total rewrite of our signal handling, though. There might be
> details I haven't considered.
>
> All of that is out-of-scope for -rc2, though. ;)
Of course.
prev parent reply other threads:[~2026-04-09 13:40 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-07 23:37 Help needed on 2.54.0-rc0 t5301.13 looping rsbecker
2026-04-08 5:20 ` Jeff King
2026-04-08 5:43 ` Jeff King
2026-04-08 11:53 ` Adrian Ratiu
2026-04-08 15:44 ` rsbecker
2026-04-08 15:52 ` rsbecker
2026-04-08 15:55 ` rsbecker
2026-04-08 16:53 ` Junio C Hamano
2026-04-08 16:58 ` rsbecker
2026-04-08 17:01 ` Adrian Ratiu
2026-04-08 17:30 ` [PATCH] t5401: test SIGPIPE with parallel hooks Jeff King
2026-04-08 15:50 ` Help needed on 2.54.0-rc0 t5301.13 looping Junio C Hamano
2026-04-08 16:26 ` Adrian Ratiu
2026-04-08 17:20 ` [PATCH] run_processes_parallel(): fix order of sigpipe handling Jeff King
2026-04-08 17:59 ` Junio C Hamano
2026-04-08 20:54 ` Junio C Hamano
2026-04-08 23:42 ` Jeff King
2026-04-09 13:40 ` Junio C Hamano [this message]
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=xmqqo6jsw8u1.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=adrian.ratiu@collabora.com \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
--cc=rsbecker@nexbridge.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.