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

Re: [PATCH] Ignore SIGPIPE when running a filter driver

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 21, 2012, 20:58 UTC
Message-ID
<7vlinvgaya.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20120221030150.GA31737@burratino>
Jonathan Nieder <jrnieder@gmail.com> writes:
Show 16 quoted lines
>> If a filter is not defined or if it fails, git behaves as if the filter
>> is a no-op passthru. However, if the filter exits before reading all
>> the content, and depending on the timing git, could be kill with
>> SIGPIPE instead.
>>
>> Ignore SIGPIPE while processing the filter to detect when it exits
>> early and fallback to using the unfiltered content.
>>
>> Signed-off-by: Jehan Bing <jehan@orb.com>
>
> For the benefit of the uninitiated ("how would ignoring an error help
> me detect an error?"): setting the SIGPIPE handler to SIG_IGN does not
> actually ignore the broken pipe condition but causes it to be reported
> as an I/O error, errno == EPIPE.  That means instead of being killed
> by SIGPIPE, git gets to fall back to passthrough and report the
> filter's mistake.
Yes.  
You could rephrase  bit better to further clarify it, perhaps like this:
    Ignore SIGPIPE when running a filter driver
    
    If a filter is not defined or if it fails, git should behave as if the
    filter is a no-op passthru.
    
    However, if the filter exits before reading all the content, depending on
    the timing, git could be killed with SIGPIPE when it tries to write to the
    pipe connected to the filter.
    
    Ignore SIGPIPE while processing the filter to give us a chance to check
    the return value from a failed write, in order to detect and act on this
    mode of failure in a more controlled way.
    
    Signed-off-by: Jehan Bing <jehan@orb.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
although I think Jehan's original was already clear enough.
> So at least on POSIX-y platforms, this patch looks good to me.  Thanks
> for writing it.
Thank you and Johannes for eyeballing and sanity checking.
Will queue.
Previous: Jonathan Nieder
Message 5 of 5 in “Ignore SIGPIPE when running a filter driver”
  1. Ignore SIGPIPE when running a filter driverJehan Bing, Feb 20, 2012
  2. Junio C HamanoFeb 20, 2012
  3. Johannes SixtFeb 21, 2012
  4. Jonathan NiederFeb 21, 2012
  5. Junio C HamanoFeb 21, 2012

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.