Re: [RFC/PATCH] avoid SIGPIPE warnings for aliases
From: Johannes Sixt <hidden>
Date: 2016-06-15 22:55:39
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.
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) -- Hannes