Thread (6 messages) flat view 6 messages, 4 authors, 2016-06-15

Re: [PATCH v3] To make GIT-VERSION-FILE, search for git more widely

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:46:46

Possibly related (same subject, not in this thread)

"Matthias Andree" [off-list ref] writes:
Am 09.05.2009, 18:55 Uhr, schrieb Junio C Hamano [off-list ref]:
quoted
"Matthias Andree" [off-list ref] writes:
quoted
quoted
Fine then.  Or you could just append "." to the $PATH ;-)
"." in the super user's PATH? Cool stuff, and so innovative.
I didn't mean to suggest PATH=$PATH:. *in the user's environment* ;-).
You do that inside GIT-VERSION-FILE, which is essentially the same thing
as running ./git$X from there.
No, it is not -- the scope of the GIT variable is much narrower than
doing  PATH=$PATH:. in the script.
If you cannot trust the top of your build directory you build git in (that
is why PATH=$PATH:. while running GIT-VERSION-FILE may be scary) and
anticipate a malicious third-party can somehow put random things (like
"test" or "cat", perhaps) there, you are already lost, don't you think?

That is where my "essentially the same" came from.
For any approach taken, we'll have to touch both the shell and the
Makefile, unless we want to manually redo things in the
GIT-VERSION-GEN  script that were already done automatically or
programmatically in  Makefile.
I actually like the rationale you mentioned in the thread (perhaps in the
original proposed commit message as well) that we should ask the freshly
built git to describe the version if available, falling back to whichever
git of random vintage found on the original $PATH.

If it weren't for $X [*1*], my preference would have been (as I said in
the discussion) to run ./git if available locally.

But I think your "deal with details like $X to figure out the name of the
freshly built git binary is in the Makefile, and pass it via GIT variable
to GIT-VERSION-GEN" is a sensible approach.  I do not remember if your
patch gave precedence to an installed git on the original $PATH or a
freshly built one, though---the precedent probably does not matter in
practice, and favoring the one found on $PATH over freshly built one does
have an advantage if we were to support cross compilation (I have a
suspicion that the current setup does not).

Thanks.


[Footnote]

*1* ... and perhaps VPATH as you mentioned earlier, but I do not know if
our current Makefile is set up to allow a layout that separates build
products from the source material, as I've never attempted to build git in
a setting where VPATH is involved.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help