From: "Priedhorsky, Reid" <reidpr@lanl.gov>
To: "git@vger.kernel.org" <git@vger.kernel.org>
Cc: "brian m. carlson" <sandals@crustytoothpaste.net>
Subject: Re: bug? subprocesses can use wrong Git if $PATH is unset
Date: Fri, 2 Jun 2023 16:14:47 +0000 [thread overview]
Message-ID: <412E82B5-79C0-4AAD-8219-AA7664E9EE1E@lanl.gov> (raw)
In-Reply-To: <ZHk5V6U9gfkuwErH@tapette.crustytoothpaste.net>
Hello Brian,
> On Jun 1, 2023, at 6:35 PM, brian m. carlson <sandals@crustytoothpaste.net> wrote:
>
> It isn't possibly to portably determine that path that was used to exec
> the current binary, so Git doesn't try to do so, and it assumes that you
> set PATH appropriately. In fact, on some systems, you can use fexecve
> to execute file descriptors pointing to files that have been unlinked,
> so in general, it's not possible to determine which binary to use
> without the PATH.
Thank you for the explanation. This is fascinating. It also explains why my script works as expected if I substitute “/usr/local/bin/git” for plain “git”.
> I don't think there's anything to change here in Git.
That seems convincing.
I do wonder if the behavior would be worth documenting, e.g. at https://git-scm.com/book/en/v2/Git-Internals-Environment-Variables, where Git’s relationship to $HOME is also documented. I would be happy to submit a pull request.
Thanks,
Reid
—
he/his
next prev parent reply other threads:[~2023-06-02 16:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-01 22:21 bug? subprocesses can use wrong Git if $PATH is unset Priedhorsky, Reid
2023-06-02 0:35 ` brian m. carlson
2023-06-02 16:14 ` Priedhorsky, Reid [this message]
2023-06-02 20:20 ` brian m. carlson
2023-06-03 1:38 ` Junio C Hamano
2023-06-07 17:43 ` Priedhorsky, Reid
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=412E82B5-79C0-4AAD-8219-AA7664E9EE1E@lanl.gov \
--to=reidpr@lanl.gov \
--cc=git@vger.kernel.org \
--cc=sandals@crustytoothpaste.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 read-only IMAP folder(s) and NNTP newsgroup(s).