git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Roman Kagan <rkagan@mail.ru>
To: git@vger.kernel.org, Eric Wong <normalperson@yhbt.net>
Cc: Junio C Hamano <gitster@pobox.com>
Subject: [PATCH 2/3] git-svn: ignore SIGPIPE
Date: Mon, 2 Apr 2012 17:52:34 +0400	[thread overview]
Message-ID: <b5b0657dbf648eccab746b5e448aacbc8dc83c8b.1335198921.git.rkagan@mail.ru> (raw)
In-Reply-To: <cover.1335198921.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

  parent reply	other threads:[~2012-04-23 16:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-23 16:35 [PATCH 0/3] git-svn: fixes for intermittent SIGPIPE Roman Kagan
2012-04-02 13:29 ` [PATCH 1/3] git-svn: use POSIX::sigprocmask to block signals Roman Kagan
2012-04-23 17:33   ` Junio C Hamano
2012-04-23 21:07     ` Roman Kagan
2012-04-23 21:13       ` Junio C Hamano
2012-04-02 13:52 ` Roman Kagan [this message]
2012-04-23 16:26 ` [PATCH 3/3] git-svn: drop redundant blocking of SIGPIPE Roman Kagan
  -- strict thread matches above, loose matches on Subject: below --
2012-04-24  6:53 [PATCH 0/3] git-svn: fixes for intermittent SIGPIPE Roman Kagan
2012-04-02 13:52 ` [PATCH 2/3] git-svn: ignore SIGPIPE Roman Kagan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b5b0657dbf648eccab746b5e448aacbc8dc83c8b.1335198921.git.rkagan@mail.ru \
    --to=rkagan@mail.ru \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=normalperson@yhbt.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).