git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Fritz Anderson <fritza@uchicago.edu>
Cc: git@vger.kernel.org, Daniel Barkalow <barkalow@iabervon.org>,
	Johannes Sixt <j6t@kdbg.org>
Subject: Re: "fatal: index-pack failed" on git-clone
Date: Wed, 08 Jul 2009 11:49:39 -0700	[thread overview]
Message-ID: <7vd48b6md8.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: 4103BA41-39E4-496F-A76F-17D84F30EA21@uchicago.edu

Fritz Anderson <fritza@uchicago.edu> writes:

> On Jul 8, 2009, at 12:34 PM, Junio C Hamano wrote:
>
>> Which makes the initial "sudo git clone..." find git in _your_ path
>> before sanitization (and that is why it even starts), but then the path
>> is nuked for the git process it launches, and we cannot find
>> git-index-pack on the PATH.
>>
>> But this should be fine, as git is expected to find git-index-pack in
>> its GIT_EXEC_PATH that is compiled in the binary of "git" itself.
>>
>> Which makes me suspect that your "git" in /usr/local/bin may be
>> misconfigured.  You might want to check what these tell you.
>>
>> 	$ git --exec-path
>> 	$ /usr/local/bin/git --exec-path
>
> Glad to oblige. These are the four possibilities:
>
> $ git --exec-path
> /usr/local/libexec/git-core
> $ /usr/local/bin/git --exec-path
> /usr/local/libexec/git-core
> $ sudo git --exec-path
> /usr/local/libexec/git-core
> $ sudo /usr/local/bin/git --exec-path
> /usr/local/libexec/git-core
> $
>
> Same path every time, sudo or not, full path to git or not.

Hmm, there is something fishy going on, and I am a bit frustrated not
being able to see what it is.

The callpath should look like this:

  git.c::main()
  -> setup_path()
  -> cmd_clone()
     -> transport_fetch_refs()
        -> fetch_refs_via_pack()
           -> fetch_pack()
              -> do_fetch_pack()
                 -> get_pack()
                    -> start_command(), running either
                       "index-pack" or "unpack-objects"
                       on the incoming stream

and start_command() forks and eventually does execv_git_cmd() which is a
thin wrapper around execvp().

The PATH exported when this execvp() runs should have been adjusted to
have the exec-path at the beginning by calling setup_path() and this is
done way before cmd_clone() was called by git.c::main() function.

What am I not seeing?  There should be something obvious that I am
missing.  I do not see how your original command can fail with "exec
failed: No such file or directory".

Could you try your original (non-working) command with this debug patch?

 exec_cmd.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/exec_cmd.c b/exec_cmd.c
index 408e4e5..000910b 100644
--- a/exec_cmd.c
+++ b/exec_cmd.c
@@ -101,6 +101,9 @@ void setup_path(void)
 	const char *old_path = getenv("PATH");
 	struct strbuf new_path = STRBUF_INIT;
 
+	trace_printf("trace: setup_path: the $PATH was: %s\n",
+		     old_path ? old_path : "NULL");
+
 	add_path(&new_path, git_exec_path());
 	add_path(&new_path, argv0_path);
 
@@ -110,7 +113,8 @@ void setup_path(void)
 		strbuf_addstr(&new_path, "/usr/local/bin:/usr/bin:/bin");
 
 	setenv("PATH", new_path.buf, 1);
-
+	trace_printf("trace: setup_path: the $PATH is now: %s\n",
+		     getenv("PATH") ? getenv("PATH") : "NULL");
 	strbuf_release(&new_path);
 }
 
@@ -138,7 +142,8 @@ int execv_git_cmd(const char **argv) {
 	execvp("git", (char **)nargv);
 
 	trace_printf("trace: exec failed: %s\n", strerror(errno));
-
+	trace_printf("trace: the $PATH was: %s\n",
+		     getenv("PATH") ? getenv("PATH") : "NULL");
 	free(nargv);
 	return -1;
 }

  reply	other threads:[~2009-07-08 18:50 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-08 15:58 "fatal: index-pack failed" on git-clone Fritz Anderson
2009-07-08 16:42 ` Junio C Hamano
2009-07-08 17:10   ` Fritz Anderson
2009-07-08 17:34     ` Junio C Hamano
2009-07-08 18:22       ` Fritz Anderson
2009-07-08 18:49         ` Junio C Hamano [this message]
2009-07-08 19:05           ` Daniel Barkalow
2009-07-08 20:05             ` Fritz Anderson
2009-07-08 20:23           ` Fritz Anderson
2009-07-08 20:42           ` Johannes Sixt
2009-07-08 21:12             ` Jeff King
2009-07-08 21:27               ` Fritz Anderson
2009-07-09 18:11               ` Johannes Sixt
2009-07-08 22:48             ` Junio C Hamano
2009-07-09  6:37               ` Jeff King
2009-07-09  8:42                 ` Michael J Gruber
2009-07-09 23:29                 ` A Large Angry SCM
2009-07-13  4:52                   ` Jeff King
  -- strict thread matches above, loose matches on Subject: below --
2009-07-09  8:06 Johannes Sixt

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=7vd48b6md8.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=barkalow@iabervon.org \
    --cc=fritza@uchicago.edu \
    --cc=git@vger.kernel.org \
    --cc=j6t@kdbg.org \
    /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).