From: Jeff King Date: Wed, 20 Feb 2013 22:03:59 GMT Subject: Re: [PATCH v3 08/19] write_or_die: raise SIGPIPE when we get EPIPE Message-ID: <20130220220359.GA1417@sigill.intra.peff.net> In-Reply-To: <20130220220114.GB24236@google.com> On Wed, Feb 20, 2013 at 02:01:14PM -0800, Jonathan Nieder wrote: > >> How about > >> > >> die("BUG: another thread changed SIGPIPE handling behind my back!"); > >> > >> to make it easier to find and fix such problems? > > > > You mean for the "should never happen" bit, not the first part, right? I > > actually wonder if we should simply exit(141) in the first place. That > > is shell exit-code for SIGPIPE death already (so it's what our > > run_command would show us, and what anybody running us through shell > > would see). > > Yes, for the "should never happen" part. Raising a signal is nice > because it means the wait()-ing process can see what happened by > checking WIFSIGNALED(status). Right. My point is that only happens if there's no shell in the way. But I guess it doesn't hurt to make the attempt to help the people using wait() directly. I don't mind adding a "BUG: " message like you described, but we should still try to exit(141) as the backup, since that is the shell-equivalent code to the SIGPIPE signal death. -Peff