From: Andreas Ericsson <ae@op5.se>
To: Michal Ostrowski <mostrows@watson.ibm.com>
Cc: Junio C Hamano <junkio@cox.net>, git@vger.kernel.org
Subject: Re: [PATCH 2/2] Remember and use GIT_EXEC_PATH on exec()'s
Date: Wed, 11 Jan 2006 01:06:42 +0100 [thread overview]
Message-ID: <43C44C12.3050609@op5.se> (raw)
In-Reply-To: <1136924980.11717.603.camel@brick.watson.ibm.com>
Michal Ostrowski wrote:
> On Tue, 2006-01-10 at 11:47 -0800, Junio C Hamano wrote:
>
>>
>>>Good point. Perhaps we should only prepend to path when the directory
>>>isn't already in $PATH, or append rather than prepend.
>>
>>I think appending not prepending would stop letting me say
>>
>> $ GIT_EXEC_PATH=/usr/libexec/git-core/0.99.9k git foo
>>
>>to try out older version, if I have more recent git in my PATH.
>>But I agree with Michal it is not nice to affect invocations of
>>"diff" (and things spawned from hooks, which would inherit PATH
>>from receive-pack).
>>
So how about prepending only when the directory isn't already in the
PATH? That can be done with a two-line patch to git.c only.
It will break the "diff in another dir" scenario in the highly unlikely
event that the other diff is located in the same dir as the git suite,
isn't supposed to be used, and the directory in question isn't in $PATH
already. People who have such a setup will be too ashamed to admit it,
so we're not likely to be blamed for it either. ;)
>>
>
>
> How about searching for executables in the following places, and in this
> order:
>
> 1. --exec-path setting, if any
> 2. GIT_EXEC_PATH env var, if set
> 3. PATH (never modified)
> 4. Value of ${bindir} at build time
>
This is more or less what's done today, with the exception that $PATH
isn't searched and it throws an error immediately no matter where
exec_path (the git.c variable) came from.
Adding $PATH to the search-pattern would be a simple matter of falling
back to execvp() if execve(), but then we could end up with running
programs from a different release while the user thinks he/she's
specifically running 1.0.3... Tricky problem, really.
>
> Secondly, the shell scripts as is cannot utilize this search order as
> long as they don't religiously use the git potty internally. If we were
> to "sed -e 's/git-/git /g' -i git*.sh" (grotesquely simplified of
> course) then they would.
>
I think this has been done, but as it happened to be convenient. I'd
prefer if the git potty could keep prepending the GIT_EXEC_PATH to the
path, really. We're bound to run into setup-related problems otherwise,
such as;
Alice writes a script that works fine for her and her friends, so she
shares it freely with Bob and whoever else might be listening. Bob's
git-tools aren't in the $PATH but he keeps the potty handy at all times.
He can't always run it through the potty because in some code-paths
Alice's script uses git-tools without going through the potty. Bob
thinks Alice puts entropy in her programs on purpose, so Alice flees,
sobbing and shaking in anger and betrayed trust. The two never speak again.
Luckily, Bruce Schneier shows up and saves the day.
--
Andreas Ericsson andreas.ericsson@op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
next prev parent reply other threads:[~2006-01-11 0:06 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-09 23:34 [PATCH 0/2] Remember and use GIT_EXEC_PATH on exec()'s Michal Ostrowski
2006-01-09 23:35 ` [PATCH 1/2] " Michal Ostrowski
2006-01-10 2:53 ` Junio C Hamano
2006-01-09 23:36 ` [PATCH 2/2] " Michal Ostrowski
2006-01-10 2:52 ` Junio C Hamano
2006-01-10 13:36 ` Michal Ostrowski
2006-01-10 15:01 ` Andreas Ericsson
2006-01-10 16:26 ` Michal Ostrowski
2006-01-10 19:13 ` Andreas Ericsson
2006-01-10 20:15 ` Alex Riesen
2006-01-10 20:32 ` Michal Ostrowski
[not found] ` <7vu0cb6f1n.fsf@assigned-by-dhcp.cox.net>
2006-01-10 20:29 ` Michal Ostrowski
2006-01-11 0:06 ` Andreas Ericsson [this message]
2006-01-11 0:42 ` Junio C Hamano
2006-01-11 2:09 ` Michal Ostrowski
2006-01-11 2:12 ` [PATCH] Exec git programs without using PATH Michal Ostrowski
2006-01-11 6:13 ` Junio C Hamano
2006-01-11 17:05 ` [PATCH] (Updated) " Michal Ostrowski
2006-01-11 20:33 ` Junio C Hamano
2006-01-11 20:42 ` Linus Torvalds
2006-01-11 21:26 ` Michal Ostrowski
2006-01-11 21:32 ` Junio C Hamano
2006-01-12 0:11 ` Andreas Ericsson
2006-01-12 5:38 ` H. Peter Anvin
2006-01-10 19:47 ` [PATCH 2/2] Remember and use GIT_EXEC_PATH on exec()'s Junio C Hamano
2006-01-10 19:55 ` Johannes Schindelin
2006-01-10 20:31 ` Michal Ostrowski
2006-01-10 21:03 ` Johannes Schindelin
2006-01-11 0:10 ` Andreas Ericsson
2006-01-11 0:57 ` Junio C Hamano
2006-01-11 11:57 ` Andreas Ericsson
2006-01-11 17:11 ` Jon Loeliger
2006-01-10 21:09 ` Junio C Hamano
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=43C44C12.3050609@op5.se \
--to=ae@op5.se \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
--cc=mostrows@watson.ibm.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).