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

Re: git-daemon breakage in 1.5.4

From
Johannes Sixt <j.sixt@viscovery.net>
Date
Feb 6, 2008, 10:28 UTC
Message-ID
<47A98BD9.5040306@viscovery.net>
In-Reply-To
<27E0A387-5A6B-4577-AAF4-ACE65A24E306@wincent.com>
Wincent Colaiuta schrieb:
Show 27 quoted lines
> El 6/2/2008, a las 10:40, Johannes Sixt escribió:
> 
>>> This fails with the "remote end hung up unexpectedly" error:
>>>
>>>  # /usr/local/bin/git-daemon --inetd --base-path=/blah -- /blah
>>
>> If you run this from the command line, you can't expect it to do anything
>> useful: It communicates with the client via stdin and stdout.
> 
> Strangely, it worked with 1.5.3.8. But I just tried to reproduce it and
> now I can't, so there must have been some error in my procedure. Doh.
> The bizarre thing is that in preparing these emails I tested it at least
> twice, which means I must have made the exact same mistake at least
> twice...
> 
>> Which makes me think that you xinetd doesn't pass a PATH to git-daemon
>> that includes /usr/local/bin. Add this to your /etc/xinetd.d/git:
>>
>>    env = PATH=/bin:/usr/bin:/usr/local/bin
>>
>> (not tested).
> 
> That works. Thanks.
> 
> It's an acceptable workaround (the other is installing /usr instead of
> /usr/local). Seeing as it worked in 1.5.3.8, does this qualify as
> breakage, or should we not worry about it?
Does this patch make a difference? (It does for me.)
diff --git a/daemon.c b/daemon.c
index 41a60af..c99285e 100644
--- a/daemon.c
+++ b/daemon.c
@@ -1026,6 +1026,7 @@ int main(int argc, char **argv)
 	struct group *group;
 	gid_t gid = 0;
 	int i;
+	char *cmd_path = strdup(argv[0]), *slash;

 	/* Without this we cannot rely on waitpid() to tell
 	 * what happened to our children.
@@ -1184,6 +1185,13 @@ int main(int argc, char **argv)
 	if (strict_paths && (!ok_paths || !*ok_paths))
 		die("option --strict-paths requires a whitelist");

+	slash = strrchr(cmd_path, '/');
+	if (slash) {
+		*slash = 0;
+		setup_path(cmd_path);
+	}
+	free(cmd_path);
+
 	if (inetd_mode) {
 		struct sockaddr_storage ss;
 		struct sockaddr *peer = (struct sockaddr *)&ss;
Previous: Wincent ColaiutaNext: Wincent Colaiuta
Message 10 of 13 in “git-daemon breakage in 1.5.4”
  1. Wincent ColaiutaFeb 5, 2008
  2. Scott ParishFeb 5, 2008
  3. Wincent ColaiutaFeb 5, 2008
  4. Junio C HamanoFeb 5, 2008
  5. Wincent ColaiutaFeb 6, 2008
  6. Junio C HamanoFeb 6, 2008
  7. Wincent ColaiutaFeb 6, 2008
  8. Johannes SixtFeb 6, 2008
  9. Wincent ColaiutaFeb 6, 2008
  10. Johannes SixtFeb 6, 2008
  11. Wincent ColaiutaFeb 6, 2008
  12. Johannes SixtFeb 6, 2008
  13. Adam PiatyszekFeb 6, 2008

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.