Re: debugging git clone via git-daemon "cannot handle daemon internally"
From: Jonathan Nieder <hidden>
Date: 2016-06-15 22:50:21
Subsystem:
the rest · Maintainer:
Linus Torvalds
John Griessen wrote:
john@toolbench:~/EEProjects/test$ telnet mail.cibolo.us 9418 Trying 76.191.252.85... Connected to mail.cibolo.us. Escape character is '^]'. fatal: cannot handle daemon internally Connection closed by foreign host. What does "cannot handle daemon internally" signify to you all?
Progress. :) Interesting.
The message comes from "main" in git.c:
if (!prefixcmp(cmd, "git-")) {
cmd += 4;
argv[0] = cmd;
handle_internal_command(argc, argv);
die("cannot handle %s internally", cmd);
}
Perhaps you have inetd set up to try to run git with argv[0] set
to git-daemon? git-daemon (daemon.c) has its own "main" so it
would take something of that nature to produce this symptom.
Maybe something like this would have made diagnosis easier.
Signed-off-by: Jonathan Nieder <redacted>
---diff --git a/pkt-line.c b/pkt-line.c
index 295ba2b..694571d 100644
--- a/pkt-line.c
+++ b/pkt-line.c@@ -121,6 +121,22 @@ static int packet_length(const char *linelen) return len; } +static void NORETURN die_bad_length(int fd, const char linelen[4]) +{ + struct strbuf msg = STRBUF_INIT; + FILE *fp; + + if ((memcmp(linelen, "fata", 4) && + memcmp(linelen, "erro", 4) && + memcmp(linelen, "warn", 4)) || + !(fp = fdopen(fd, "r"))) + die("protocol error: bad line length character: %.4s", linelen); + + strbuf_getline(&msg, fp, '\n'); + die("protocol error: bad line length character: %.4s%s", + linelen, msg.buf); +} + int packet_read_line(int fd, char *buffer, unsigned size) { int len;
@@ -129,7 +145,7 @@ int packet_read_line(int fd, char *buffer, unsigned size) safe_read(fd, linelen, 4); len = packet_length(linelen); if (len < 0) - die("protocol error: bad line length character: %.4s", linelen); + die_bad_length(fd, linelen); if (!len) return 0; len -= 4;