Re: bug? subprocesses can use wrong Git if $PATH is unset

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Brian,

> On Jun 1, 2023, at 6:35 PM, brian m. carlson <sandals@xxxxxxxxxxxxxxxxxxxx> 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




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux