From: Johannes Sixt <j6t@kdbg.org>
To: Jeff King <peff@peff.net>
Cc: Junio C Hamano <gitster@pobox.com>,
Fritz Anderson <fritza@uchicago.edu>,
git@vger.kernel.org, Daniel Barkalow <barkalow@iabervon.org>
Subject: Re: "fatal: index-pack failed" on git-clone
Date: Thu, 09 Jul 2009 10:06:30 +0200 (CEST) [thread overview]
Message-ID: <mtranet.20090709100630.408099298@telekom.at> (raw)
Jeff King schrieb:
> Subject: [PATCH] Makefile: install 'git' in execdir
>
> When a git command executes a subcommand, it uses the "git
> foo" form, which relies on finding "git" in the PATH.
> Normally this should not be a problem, since the same "git"
> that was used to invoke git in the first place will be
> found. And if somebody invokes a "git" outside of the PATH
> (e.g., by giving its absolute path), this case is already
> covered: we put that absolute path onto the front of PATH.
>
> However, if one is using "sudo", then sudo will execute the
> "git" from the PATH, but pass along a restricted PATH that
> may not contain the original "git" directory. In this case,
> executing a subcommand will fail.
>
> To solve this, we put the "git" wrapper itself into the
> execdir; this directory is prepended to the PATH when git
> starts, so the wrapper will always be found.
I'd love to see this change justified not only by sudo, because
this also helps another use-case where it avoids that between
different vintages of git is switched:
Assume you have a git installed in prefix /usr and another one
in prefix /home/j6t. PATH is /usr/bin:/bin. Consider this command:
$ git --exec-path=/home/j6t/libexec/git-core gc
Then:
1. It runs /usr/bin/git with builtin gc.
2. It set PATH=/home/j6t/libexec/git-core:/usr/bin:/bin
3. builtin-gc runs git repack (no dash). It picks git-repack
from /home/j6t. (PATH remains unchanged)
4. git-repack runs git pack-objects.
5. This picked /usr/bin/git and its builtin pack-objects
See how this switches from the version in /usr to /home/j6t
and back to /usr?
With this change it switches from /usr to /home/j6t and
remains there, which is "more correct", IMO (at least
less surprising).
Notice that the problem is not only with --exec-path, but
also with GIT_EXEC_PATH if somebody has it exported
in .profile.
-- Hannes
next reply other threads:[~2009-07-09 8:06 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-09 8:06 Johannes Sixt [this message]
-- strict thread matches above, loose matches on Subject: below --
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
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
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=mtranet.20090709100630.408099298@telekom.at \
--to=j6t@kdbg.org \
--cc=barkalow@iabervon.org \
--cc=fritza@uchicago.edu \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
/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).