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

Re: "fatal: index-pack failed" on git-clone

From
Johannes Sixt <j6t@kdbg.org>
Date
Jul 8, 2009, 20:42 UTC
Message-ID
<200907082242.51495.j6t@kdbg.org>
In-Reply-To
<7vd48b6md8.fsf@alter.siamese.dyndns.org>
On Mittwoch, 8. Juli 2009, Junio C Hamano wrote:
Show 7 quoted lines
> 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".

It failed because /usr/local/bin is not in the PATH when git is run with sudo. Look at the original trace output:

> $ sudo GIT_TRACE=1 git clone ...

At this point PATH is "/bin:/usr/bin" and the invoked git is /usr/local/bin/git (appearently!).

> trace: built-in: git 'clone' ...
> Initialized empty Git repository in /srv/scientia/.git/
> trace: run_command: 'ssh' ... 'git-upload-pack ...
> Password:

At this point PATH is "/usr/local/libexec/git-core:/bin:/usr/bin". There is no /usr/local/bin.

> trace: run_command: 'index-pack' '--stdin' '-v' '--fix-thin' ...
> trace: exec: 'git' 'index-pack' '--stdin' '-v' '--fix-thin' ...
The PATH doesn't have 'git'; this must fail.
> trace: exec failed: No such file or directory
> trace: exec 'index-pack' failed: No such file or directory
> fatal: index-pack failed

However, if Fritz runs 'sudo /usr/local/bin/git clone ...', then the interim PATH is "/usr/local/bin:/usr/local/libexec/git-core:/bin:/usr/bin" because this time setup_path() finds a non-empty argv0_path, and the command works.

-- Hannes
Previous: Fritz AndersonNext: Jeff King
Message 10 of 18 in “"fatal: index-pack failed" on git-clone”
  1. Fritz AndersonJul 8, 2009
  2. Junio C HamanoJul 8, 2009
  3. Fritz AndersonJul 8, 2009
  4. Junio C HamanoJul 8, 2009
  5. Fritz AndersonJul 8, 2009
  6. Junio C HamanoJul 8, 2009
  7. Daniel BarkalowJul 8, 2009
  8. Fritz AndersonJul 8, 2009
  9. Fritz AndersonJul 8, 2009
  10. Johannes SixtJul 8, 2009
  11. Jeff KingJul 8, 2009
  12. Fritz AndersonJul 8, 2009
  13. Johannes SixtJul 9, 2009
  14. Junio C HamanoJul 8, 2009
  15. Jeff KingJul 9, 2009
  16. Michael J GruberJul 9, 2009
  17. A Large Angry SCMJul 9, 2009
  18. Jeff KingJul 13, 2009

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.