git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Junio C Hamano <junkio@cox.net>
Date
Jan 20, 2007, 19:24 UTC
Message-ID
<7vk5zh7b7d.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<17842.1385.366750.915767@lisa.zopyra.com>
Bill Lear <rael@zopyra.com> writes:
Show 18 quoted lines
> % git push
> updating 'refs/heads/master'
>   from 6b421066e842203e383e1dc466c1cdef10de56b1
>   to   2a8e554ae0c99d44988690c9fce693b3f5f128fa
> Generating pack...
> Done counting 61 objects.
> Result has 32 objects.
> Deltifying 32 objects.
>  100% (32/32) done
> Writing 32 objects.
>  100% (32/32) done
> Total 32, written 32 (delta 18), reused 0 (delta 0)
> Unpacking 32 objects
> fatal: protocol error: bad line length character
>
> The notion of fatality led him to think, quite plausibly, that
> something very bad had happened with his push.  However, we can find
> no evidence that anything bad really did happen.

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;
Previous: Bill LearNext: Junio C Hamano
Message 2 of 17 in “Meaning of "fatal: protocol error: bad line length character"?”
  1. Bill LearJan 20, 2007
  2. Junio C HamanoJan 20, 2007
  3. Junio C HamanoJan 20, 2007
  4. Bill LearJan 20, 2007
  5. Jakub NarebskiJan 20, 2007
  6. Junio C HamanoJan 20, 2007
  7. Junio C HamanoJan 20, 2007
  8. Shawn O. PearceJan 20, 2007
  9. Junio C HamanoJan 22, 2007
  10. Bill LearJan 22, 2007
  11. Junio C HamanoJan 22, 2007
  12. Bill LearJan 22, 2007
  13. Bill LearJan 22, 2007
  14. Junio C HamanoJan 22, 2007
  15. Han-Wen NienhuysJan 23, 2007
  16. Junio C HamanoJan 23, 2007
  17. Han-Wen NienhuysJan 23, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.