Re: [PATCH v3 08/19] write_or_die: raise SIGPIPE when we get EPIPE
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 20, 2013, 22:19 UTC
- Message-ID
- <7vfw0qy6g7.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <20130220221248.GC817@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 24 quoted lines
> I am more concerned that the assertion is not "oops, another thread is
> doing something crazy, and it is a bug", but rather that there is some
> weird platform where SIG_DFL does not kill the program under SIGPIPE.
> That seems pretty crazy, though. I think I'd squash in something like
> this:
>
> diff --git a/write_or_die.c b/write_or_die.c
> index b50f99a..abb64db 100644
> --- a/write_or_die.c
> +++ b/write_or_die.c
> @@ -5,7 +5,9 @@ static void check_pipe(int err)
> if (err == EPIPE) {
> signal(SIGPIPE, SIG_DFL);
> raise(SIGPIPE);
> +
> /* Should never happen, but just in case... */
> + error("BUG: SIGPIPE on SIG_DFL handler did not kill us.");
> exit(141);
> }
> }
>
> which more directly reports the assertion that failed, and degrades
> reasonably gracefully. Yeah, it's probably overengineering, but it's
> easy enough to do.Yeah, that sounds like a sensible thing to do, as it is cheap even though we do not expect it to trigger.