From: Priedhorsky, Reid Date: Fri, 02 Jun 2023 16:14:47 GMT Subject: Re: bug? subprocesses can use wrong Git if $PATH is unset Message-ID: <412E82B5-79C0-4AAD-8219-AA7664E9EE1E@lanl.gov> In-Reply-To: Hello Brian, > On Jun 1, 2023, at 6:35 PM, brian m. carlson 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