git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Sixt <j.sixt@viscovery.net>
To: Wincent Colaiuta <win@wincent.com>
Cc: Junio C Hamano <gitster@pobox.com>,
	git mailing list <git@vger.kernel.org>,
	Scott R Parish <sRp@srparish.net>
Subject: Re: git-daemon breakage in 1.5.4
Date: Wed, 06 Feb 2008 11:28:41 +0100	[thread overview]
Message-ID: <47A98BD9.5040306@viscovery.net> (raw)
In-Reply-To: <27E0A387-5A6B-4577-AAF4-ACE65A24E306@wincent.com>

Wincent Colaiuta schrieb:
> 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;

  reply	other threads:[~2008-02-06 10:29 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-05 15:39 git-daemon breakage in 1.5.4 Wincent Colaiuta
2008-02-05 17:49 ` Scott Parish
2008-02-05 19:28   ` Wincent Colaiuta
2008-02-05 20:02 ` Junio C Hamano
2008-02-06  8:05   ` Wincent Colaiuta
2008-02-06  8:46     ` Junio C Hamano
2008-02-06  9:44       ` Wincent Colaiuta
2008-02-06  9:40     ` Johannes Sixt
2008-02-06 10:12       ` Wincent Colaiuta
2008-02-06 10:28         ` Johannes Sixt [this message]
2008-02-06 11:39           ` Wincent Colaiuta
2008-02-06 11:33       ` Johannes Sixt
2008-02-06 12:02       ` Adam Piatyszek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47A98BD9.5040306@viscovery.net \
    --to=j.sixt@viscovery.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=sRp@srparish.net \
    --cc=win@wincent.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).