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

Subsystems: the rest

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

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

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:42:50

Bill Lear [off-list ref] writes:
% 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;

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

From: Han-Wen Nienhuys <hidden>
Date: 2016-06-15 22:42:50

Junio C Hamano escreveu:
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).
if you need another example where this is happening, the anongit
repo for lilypond seems to have gotten in this state as well,

[hanwen@haring tmp]$ git clone git://git.sv.gnu.org/lilypond.git
Initialized empty Git repository in /tmp/lilypond/.git/
fatal: protocol error: bad line length character
fetch-pack from 'git://git.sv.gnu.org/lilypond.git' failed.


pushing/pulling over ssh+git and http still work.
  

(git 1.5.0rc2, not sure what git.sv.gnu.org is running)

-- 
 Han-Wen Nienhuys - hanwen@xs4all.nl - http://www.xs4all.nl/~hanwen
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help