Subject: Re: [PATCH v2] unblock and unignore SIGPIPE

From: Junio C Hamano <[email-masked]>
Date: Mon, 22 Sep 2014 10:30:38 -0700

Johannes Sixt <[email-masked]> writes:

>> +static void restore_sigpipe_to_default(void)
>> +{
>> +	sigset_t unblock;
>> +
>> +	sigemptyset(&unblock);
>> +	sigaddset(&unblock, SIGPIPE);
>> +	sigprocmask(SIG_UNBLOCK, &unblock, NULL);
>> +	signal(SIGPIPE, SIG_DFL);
>> +}
>
> This does not build on MinGW due to missing sigaddset() and
> sigprocmask(). I've a patch that adds dummies for them (but I ran out of
> time to complete it for submission). But then the test cases ...
>
>> +test_expect_success 'a constipated git dies with SIGPIPE' '
>> +	OUT=$( ((large_git; echo $? 1>&3) | :) 3>&1 )
>> +	test "$OUT" -eq 141
>> +'
>> +
>> +test_expect_success 'a constipated git dies with SIGPIPE even if parent ignores it' '
>> +	OUT=$( ((trap "" PIPE; large_git; echo $? 1>&3) | :) 3>&1 )
>> +	test "$OUT" -eq 141
>> +'
>
> ... fail always because we neither get SIGPIPE (we don't have it on
> Windows) nor do we see a write error (e.g. EPIPE) when writing to the
> pipe. Should I protect these tests with !MINGW or would it be an option
> to drop these tests alltogether?

Let's do !MINGW for now, unless somebody can think of a reason why
this change and tests are a bad idea (e.g. "we are not in the
business of preventing users from shooting themselves; have the
users bug those who wrote the software that spawns us with SIGPIPE
ignored", to which I am sympathetic to some degree but not very much
because I am also a practical person).

Thanks.