Re: BUG: git bash / python interaction with absolute paths as environment variables in Windows
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Dec 7, 2021, 21:39 UTC
- Message-ID
- <nycvar.QRO.7.76.6.2112072235400.90@tvgsbejvaqbjf.bet>
- In-Reply-To
- <CAHeq4YxktibxMBnMLwEq9Nvsgw0UqCrjW2WPcerJCM4mXKxiEw@mail.gmail.com>
Hi Leland,
On Mon, 6 Dec 2021, Leland Weathers wrote:
> Issue: Using Git Bash for Windows (2.34.1-64) and Python 3.9.9, a git > path is incorrectly prepended to environment variables in Python code.
From Git for Windows' [Release Notes' "Known Issues" section](https://github.com/git-for-windows/build-extra/blob/master/ReleaseNotes.md#known-issues):
* If you specify command-line options starting with a slash, POSIX-to-Windows path conversion will kick in converting e.g. "`/usr/bin/bash.exe`" to "`C:\Program Files\Git\usr\bin\bash.exe`". When that is not desired -- e.g. "`--upload-pack=/opt/git/bin/git-upload-pack`" or "`-L/regex/`" -- you need to set the environment variable `MSYS_NO_PATHCONV` temporarily, like so:
> `MSYS_NO_PATHCONV=1 git blame -L/pathconv/ msys2_path_conv.cc`
Alternatively, you can double the first slash to avoid POSIX-to-Windows path conversion, e.g. "`//usr/bin/bash.exe`".
Those release notes are shown by default when you install Git for Windows, and they are also accessible via the Start Menu as "Git Release Notes".
Show 5 quoted lines
> [... snip ...] > > In both cases I am using the same Python virtual environment. Other > environment variables (e.g. non-absolute directory paths) appear to be > read correctly. I'm assuming that this is a git issue given the
Premature end-of-mail?
Ciao, Johannes