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

Re: [PATCH] unblock and unignore SIGPIPE

From
Jeff King <peff@peff.net>
Date
Sep 17, 2014, 08:11 UTC
Message-ID
<20140917081148.GB16200@peff.net>
In-Reply-To
<xmqqd2av1bsg.fsf@gitster.dls.corp.google.com>
On Tue, Sep 16, 2014 at 02:43:43PM -0700, Junio C Hamano wrote:
Show 14 quoted lines
> > +/* un-ignore and un-block SIGPIPE */
> > +void sanitize_signals(void)
> > +{
> > +	sigset_t unblock;
> > +
> > +	sigemptyset(&unblock);
> > +	sigaddset(&unblock, SIGPIPE);
> > +	sigprocmask(SIG_UNBLOCK, &unblock, NULL);
> > +	signal(SIGPIPE, SIG_DFL);
> 
> With the only caller in git.c, there is not a good reason that we
> would want to have this as a global in a different file (I think the
> patch merely follows the pattern of sanitize-fds, but that one has
> to be called from many places).

Would we want to call it from external C commands, too? For the most part, git.c is the entry point for running git commands, and any sanitizing it does will be inherited by sub-commands. But it _is_ still legal to call dashed commands individually, and even required in some cases (e.g., git-upload-pack for ssh clients).

Show 10 quoted lines
> > diff --git a/t/t0012-sigpipe.sh b/t/t0012-sigpipe.sh
> > new file mode 100755
> > index 0000000..213cde3
> > --- /dev/null
> > +++ b/t/t0012-sigpipe.sh
> > @@ -0,0 +1,27 @@
> > +#!/bin/sh
> 
> Hmmm, do we really need to allocate a new test number just for these
> two tests, instead of folding it into an existing one?

I see in your proposed patch below you put them into t0000. I wonder if t0005 would be a more obvious place.

-Peff
Previous: Junio C HamanoNext: Junio C Hamano
Message 5 of 8 in “unblock and unignore SIGPIPE”
  1. unblock and unignore SIGPIPEPatrick Reynolds, Aug 15, 2014
  2. Eric WongAug 18, 2014
  3. Patrick ReynoldsAug 22, 2014
  4. Junio C HamanoSep 16, 2014
  5. Jeff KingSep 17, 2014
  6. Junio C HamanoSep 17, 2014
  7. Patrick ReynoldsSep 18, 2014
  8. Junio C HamanoSep 18, 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.