Subject: Re: [PATCH] unblock and unignore SIGPIPE

From: Jeff King <[email-masked]>
Date: Wed, 17 Sep 2014 04:11:49 -0400

On Tue, Sep 16, 2014 at 02:43:43PM -0700, Junio C Hamano wrote:

> > +/* 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).

> > 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