Re: [PATCH v2] unblock and unignore SIGPIPE
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 22, 2014, 17:30 UTC
- Message-ID
- <xmqqwq8vlg01.fsf@gitster.dls.corp.google.com>
- In-Reply-To
- <541D3E0C.4030400@kdbg.org>
Johannes Sixt <j6t@kdbg.org> writes:
Show 28 quoted lines
>> +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.