summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d0482e8)
raw | patch | inline | side by side (parent: d0482e8)
author | Jehan Bing <jehan@orb.com> | |
Mon, 20 Feb 2012 20:53:37 +0000 (12:53 -0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 21 Feb 2012 20:48:09 +0000 (12:48 -0800) |
If a filter is not defined or if it fails, git should behave as if the
filter is a no-op passthru.
However, if the filter exits before reading all the content, depending on
the timing, git could be killed with SIGPIPE when it tries to write to the
pipe connected to the filter.
Ignore SIGPIPE while processing the filter to give us a chance to check
the return value from a failed write, in order to detect and act on this
mode of failure in a more controlled way.
Signed-off-by: Jehan Bing <jehan@orb.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
filter is a no-op passthru.
However, if the filter exits before reading all the content, depending on
the timing, git could be killed with SIGPIPE when it tries to write to the
pipe connected to the filter.
Ignore SIGPIPE while processing the filter to give us a chance to check
the return value from a failed write, in order to detect and act on this
mode of failure in a more controlled way.
Signed-off-by: Jehan Bing <jehan@orb.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
convert.c | patch | blob | history |
diff --git a/convert.c b/convert.c
index 12868ed7bda11648704ffe4e5d3415067764a6e2..33373b3ac0ebeaeb39167b006a9e11494b5e837a 100644 (file)
--- a/convert.c
+++ b/convert.c
#include "attr.h"
#include "run-command.h"
#include "quote.h"
+#include "sigchain.h"
/*
* convert.c - convert a file when checking it out and checking it in.
if (start_command(&child_process))
return error("cannot fork to run external filter %s", params->cmd);
+ sigchain_push(SIGPIPE, SIG_IGN);
+
write_err = (write_in_full(child_process.in, params->src, params->size) < 0);
if (close(child_process.in))
write_err = 1;
if (write_err)
error("cannot feed the input to external filter %s", params->cmd);
+ sigchain_pop(SIGPIPE);
+
status = finish_command(&child_process);
if (status)
error("external filter %s failed %d", params->cmd, status);