git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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.
Previous: Johannes SixtNext: Johannes Sixt
Message 5 of 6 in “unblock and unignore SIGPIPE”
  1. unblock and unignore SIGPIPEPatrick Reynolds, Sep 18, 2014
  2. Junio C HamanoSep 18, 2014
  3. James NylenSep 18, 2014
  4. Johannes SixtSep 20, 2014
  5. Junio C HamanoSep 22, 2014
  6. mingw.h: add dummy functions for sigset_t operationsJohannes Sixt, Sep 22, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.