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

Re: [RFC/PATCH] avoid SIGPIPE warnings for aliases

From
Jeff King <peff@peff.net>
Date
Jan 4, 2013, 21:25 UTC
Message-ID
<20130104212534.GA2304@sigill.intra.peff.net>
In-Reply-To
<50E70976.5040001@kdbg.org>
On Fri, Jan 04, 2013 at 05:55:18PM +0100, Johannes Sixt wrote:
Show 15 quoted lines
> Am 04.01.2013 13:47, schrieb Jeff King:
> > I have two reservations with this patch:
> > 
> >   1. We are ignoring SIGPIPE all the time. For an alias that is calling
> >      "log", that is fine. But if pack-objects dies on the server side,
> >      seeing that it died from SIGPIPE is useful data, and we are
> >      squelching that. Maybe callers of run-command should have to pass
> >      an "ignore SIGPIPE" flag?
> 
> I am of two minds. On the one hand, losing useful debugging information
> is not something we should do lightly. On the other hand, the message is
> really noise most of the time, even on servers: when pack-objects dies
> on the server side, it is most likely due to a connection that breaks
> (voluntarily or involuntarily) half-way during a transfer, and is
> presumably a frequent event, and as such not worth noting most of the time.

Yeah. I'd mostly be worried about a case where pack-objects prints nothing (because it dies due to pipe), and then the outer process is not sufficiently verbose (it just says something like "pack-objects died abnormally", and the user is left scratching their head. I.e., it _is_ uninteresting, but because we are too silent, the user does not even know it is uninteresting.

Pack-objects is already careful to check all of its writes. I really think it would be fine to just ignore SIGPIPE, and then it would produce a useful error message on EPIPE. The downside is that if we accidentally have an unchecked call, we won't notice the error (we'll probably notice it later, but we might continue uselessly spewing data in the meantime). Perhaps we should catch SIGPIPE in such programs and print an error message.

Show 14 quoted lines
> >   2. The die_errno in handle_alias is definitely wrong. Even if we want
> >      to print a message for signal death, showing errno is bogus unless
> >      the return value was -1. But is it the right thing to just pass the
> >      negative value straight to exit()? It works, but it is depending on
> >      the fact that (unsigned char)(ret & 0xff) behaves in a certain way
> >      (i.e., that we are on a twos-complement platform, and -13 becomes
> >      141). That is not strictly portable, but it is probably fine in
> >      practice. I'd worry more about exit() doing something weird on
> >      Windows.
> 
> It did something weird on Windows until we added this line to
> compat/mingw.h:
> 
> #define exit(code) exit((code) & 0xff)
Ah, makes sense. I think that hunk of my patch is probably good, then.
-Peff
Previous: Johannes SixtNext: Junio C Hamano
Message 3 of 23 in “avoid SIGPIPE warnings for aliases”
  1. avoid SIGPIPE warnings for aliasesJeff King, Jan 4, 2013
  2. Johannes SixtJan 4, 2013
  3. Jeff KingJan 4, 2013
  4. Junio C HamanoJan 4, 2013
  5. Jeff KingJan 5, 2013
  6. run-command: encode signal death as a positive integerJeff King, Jan 5, 2013
  7. Johannes SixtJan 5, 2013
  8. Jonathan NiederJan 5, 2013
  9. Jeff KingJan 5, 2013
  10. Jonathan NiederJan 5, 2013
  11. Junio C HamanoJan 6, 2013
  12. Junio C HamanoJan 9, 2013
  13. Jeff KingJan 9, 2013
  14. Junio C HamanoJan 9, 2013
  15. Jonathan NiederJan 10, 2013
  16. Junio C HamanoJan 10, 2013
  17. Jeff KingJan 10, 2013
  18. Junio C HamanoJan 10, 2013
  19. Jeff KingJan 10, 2013
  20. Johannes SixtJan 10, 2013
  21. Junio C HamanoJan 10, 2013
  22. Jeff KingJan 10, 2013
  23. mimimimiJul 21, 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.