git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Horst Schirmeier <horst@schirmeier.com>
Cc: git@vger.kernel.org
Subject: [PATCH 6/6] send-pack: report signal death of pack-objects
Date: Tue, 7 Mar 2017 08:39:48 -0500	[thread overview]
Message-ID: <20170307133948.x3w6nufae7tbgeka@sigill.intra.peff.net> (raw)
In-Reply-To: <20170307133437.qee2jtynbiwf6uzr@sigill.intra.peff.net>

If our pack-objects sub-process dies of a signal, then it
likely didn't have a chance to write anything useful to
stderr. The user may be left scratching their head why the
push failed. Let's detect this situation and write something
to stderr.

Signed-off-by: Jeff King <peff@peff.net>
---
We could drop the SIGPIPE special-case, but I think it's just noise
after the unpack-status fix in the previous commit.

 send-pack.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/send-pack.c b/send-pack.c
index e15232739..d2d2a49a0 100644
--- a/send-pack.c
+++ b/send-pack.c
@@ -72,6 +72,7 @@ static int pack_objects(int fd, struct ref *refs, struct sha1_array *extra, stru
 	struct child_process po = CHILD_PROCESS_INIT;
 	FILE *po_in;
 	int i;
+	int rc;
 
 	i = 4;
 	if (args->use_thin_pack)
@@ -125,8 +126,20 @@ static int pack_objects(int fd, struct ref *refs, struct sha1_array *extra, stru
 		po.out = -1;
 	}
 
-	if (finish_command(&po))
+	rc = finish_command(&po);
+	if (rc) {
+		/*
+		 * For a normal non-zero exit, we assume pack-objects wrote
+		 * something useful to stderr. For death by signal, though,
+		 * we should mention it to the user. The exception is SIGPIPE
+		 * (141), because that's a normal occurence if the remote end
+		 * hangs up (and we'll report that by trying to read the unpack
+		 * status).
+		 */
+		if (rc > 128 && rc != 141)
+			error("pack-objects died of signal %d", rc - 128);
 		return -1;
+	}
 	return 0;
 }
 
-- 
2.12.0.429.gde83c8049

  parent reply	other threads:[~2017-03-07 13:48 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-07 11:03 regression: git push in non-shared repo stalls (v2.11.0+) Horst Schirmeier
2017-03-07 11:14 ` Horst Schirmeier
2017-03-07 13:34   ` [PATCH 0/6] deadlock regression in v2.11.0 with failed mkdtemp Jeff King
2017-03-07 13:35     ` [PATCH 1/6] receive-pack: fix deadlock when we cannot create tmpdir Jeff King
2017-03-07 13:35     ` [PATCH 2/6] send-pack: extract parsing of "unpack" response Jeff King
2017-03-07 13:36     ` [PATCH 3/6] send-pack: use skip_prefix for parsing unpack status Jeff King
2017-03-07 13:37     ` [PATCH 4/6] send-pack: improve unpack-status error messages Jeff King
2017-03-07 22:56       ` Junio C Hamano
2017-03-08  5:45         ` Jeff King
2017-03-08 17:19           ` Junio C Hamano
2017-03-07 13:38     ` [PATCH 5/6] send-pack: read "unpack" status even on pack-objects failure Jeff King
2017-03-07 13:39     ` Jeff King [this message]
2017-03-07 13:50     ` [PATCH 0/6] deadlock regression in v2.11.0 with failed mkdtemp Jeff King
2017-03-08 17:58     ` Horst Schirmeier

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=20170307133948.x3w6nufae7tbgeka@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=horst@schirmeier.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).