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

login
register
mail settings
Submitter Jun Wu
Date March 15, 2016, 9:58 a.m.
Message ID <d087d514ee79bad4a269.1458035916@x1c>
Download mbox | patch
Permalink /patch/13896/
State Accepted
Delegated to: Yuya Nishihara
Headers show

Comments

Jun Wu - March 15, 2016, 9:58 a.m.
# HG changeset patch
# User Jun Wu <quark@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.
Yuya Nishihara - March 17, 2016, 2:26 p.m.
On Tue, 15 Mar 2016 09:58:36 +0000, Jun Wu wrote:
> # HG changeset patch
> # User Jun Wu <quark@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

Queued this, thanks.

> 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);
> +	}

I've inserted a short comment why we don't use abortmsg().

Patch

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);