[PATCH 5 of 5] chg: downgrade "failed to read channel" from abortmsg to debugmsg

Jun Wu quark at fb.com
Tue Mar 15 05:58:36 EDT 2016


# HG changeset patch
# User Jun Wu <quark at fb.com>
# Date 1457998094 0
#      Mon Mar 14 23:28:14 2016 +0000
# Node ID d087d514ee79bad4a269bba32fd6dec7103e290f
# Parent  1dcd622a1f8ffdbfedad1a284dc09c5ea409712d
chg: downgrade "failed to read channel" from abortmsg to debugmsg

If the server has an uncaught exception, it will exit without being able to
write the channel information. In this case, the client is likely to complain
about "failed to read channel", which looks inconsistent with original hg.
This patch silences the error message and makes uncaught exception behavior
more like original hg. It will help chg to pass test-fileset.t.

diff --git a/contrib/chg/hgclient.c b/contrib/chg/hgclient.c
--- a/contrib/chg/hgclient.c
+++ b/contrib/chg/hgclient.c
@@ -106,8 +106,10 @@
 	assert(hgc);
 
 	ssize_t rsize = recv(hgc->sockfd, &hgc->ctx.ch, sizeof(hgc->ctx.ch), 0);
-	if (rsize != sizeof(hgc->ctx.ch))
-		abortmsg("failed to read channel");
+	if (rsize != sizeof(hgc->ctx.ch)) {
+		debugmsg("failed to read channel");
+		exit(255);
+	}
 
 	uint32_t datasize_n;
 	rsize = recv(hgc->sockfd, &datasize_n, sizeof(datasize_n), 0);


More information about the Mercurial-devel mailing list