credential.c, run_credential_helper(): now ignores SIGPIPE when writing to credential helper. Avoids problem with race where cred helper exits very quickly and, after, git tries to write to it, generating SIGPIPE and crashing git. To reproduce this the cred helper must not read from STDIN. This was seen with a custom credential helper, written in Go, which ignored the store command (STDIN not read) and then did a quick exit. Even with this fast helper the race was pretty rare, ie: was only seen on some of our older VM's running 2.6.18-416.el5 #1 SMP linux for whatever reason. On these VM's it occurred only once every few hundred git cmds. --- credential.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/credential.c b/credential.c index 9747f47b1..62be651b0 100644 --- a/credential.c +++ b/credential.c @@ -5,6 +5,7 @@ #include "run-command.h" #include "url.h" #include "prompt.h" +#include "sigchain.h" void credential_init(struct credential *c) { @@ -227,8 +228,10 @@ static int run_credential_helper(struct credential *c, return -1; fp = xfdopen(helper.in, "w"); + sigchain_push(SIGPIPE, SIG_IGN); credential_write(c, fp); fclose(fp); + sigchain_pop(SIGPIPE); if (want_output) { int r; -- 2.16.3.dirty