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

[PATCH 2/3] git-svn: ignore SIGPIPE

From
Roman Kagan <rkagan@mail.ru>
Date
Apr 2, 2012, 13:52 UTC
Message-ID
<eee8a701e14491463ee211e19958d5e6d4377b03.1335250396.git.rkagan@mail.ru>
In-Reply-To
<cover.1335250396.git.rkagan@mail.ru>

In HTTP with keep-alive it's not uncommon for the client to notice that the server decided to stop maintaining the current connection only when sending a new request. This naturally results in -EPIPE and possibly SIGPIPE.

The subversion library itself makes no provision for SIGPIPE. Some combinations of the underlying libraries do (typically SIG_IGN-ing it), some don't.

Presumably for that reason all subversion commands set SIGPIPE to SIG_IGN early in their main()-s.

So should we.

This, together with the previous patch, fixes the notorious "git-svn died of signal 13" problem (see e.g. http://thread.gmane.org/gmane.comp.version-control.git/134936).

Signed-off-by: Roman Kagan <rkagan@mail.ru>
---
 git-svn.perl |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/git-svn.perl b/git-svn.perl
index 570504c..aa14564 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -36,6 +36,11 @@ $ENV{TZ} = 'UTC';
 $| = 1; # unbuffer STDOUT
 
 sub fatal (@) { print STDERR "@_\n"; exit 1 }
+
+# All SVN commands do it.  Otherwise we may die on SIGPIPE when the remote
+# repository decides to close the connection which we expect to be kept alive.
+$SIG{PIPE} = 'IGNORE';
+
 sub _req_svn {
 	require SVN::Core; # use()-ing this causes segfaults for me... *shrug*
 	require SVN::Ra;
-- 
1.7.7.6
Previous: Roman KaganNext: Roman Kagan
Message 3 of 6 in “git-svn: fixes for intermittent SIGPIPE”
  1. 0/3 git-svn: fixes for intermittent SIGPIPERoman Kagan, Apr 24, 2012
  2. 1/3 git-svn: use POSIX::sigprocmask to block signalsRoman Kagan, Apr 2, 2012
  3. 2/3 git-svn: ignore SIGPIPERoman Kagan, Apr 2, 2012
  4. 3/3 git-svn: drop redundant blocking of SIGPIPERoman Kagan, Apr 23, 2012
  5. Eric WongApr 24, 2012
  6. Junio C HamanoApr 24, 2012

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.