login
Header Space

 
 

Re: Meaning of "fatal: protocol error: bad line length character"?

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Bill Lear <rael@...>
Cc: <git@...>
Date: Saturday, January 20, 2007 - 3:24 pm

Bill Lear <rael@zopyra.com> writes:


I've seen this "bad line length character" mentioned in #git and
on this list but nobody seems to have hunted down what this is.

	http://www.gelato.unsw.edu.au/archives/git/0603/17807.html

is another (Google finds some others for the error message on
xcb list but that is about fetch-pack which is totally different
codepath).

Your report and the above one both mention there was no harm,
which is somewhat of consolation but it definitely is not a good
sign.

I've tried to reproduce it, suspecting it could be some
interaction with hook scripts output, without success.

I've committed the following to 'master' so that when it
reproduces we could have a slightly better clue on what we are
getting instead of what we are expecting.

diff --git a/pkt-line.c b/pkt-line.c
index b4cb7e2..369eec9 100644
--- a/pkt-line.c
+++ b/pkt-line.c
@@ -81,13 +81,13 @@ int packet_read_line(int fd, char *buffer, unsigned size)
 {
 	int n;
 	unsigned len;
-	char linelen[4];
+	unsigned char linelen[4];
 
-	safe_read(fd, linelen, 4);
+	safe_read(fd, (char *)linelen, 4);
 
 	len = 0;
 	for (n = 0; n < 4; n++) {
-		unsigned char c = linelen[n];
+		char c = linelen[n];
 		len <<= 4;
 		if (c >= '0' && c <= '9') {
 			len += c - '0';
@@ -101,7 +101,9 @@ int packet_read_line(int fd, char *buffer, unsigned size)
 			len += c - 'A' + 10;
 			continue;
 		}
-		die("protocol error: bad line length character");
+		die("protocol error: bad line length character: "
+		    "%02x %02x %02x %02x",
+		    linelen[0], linelen[1], linelen[2], linelen[3]);
 	}
 	if (!len)
 		return 0;

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: Meaning of "fatal: protocol error: bad line length chara..., Junio C Hamano, (Sat Jan 20, 3:24 pm)
speck-geostationary