vcpkg_from_git (SSH URL) affected by user environment #19197
Replies: 13 comments 1 reply
-
Somewhat related to that particular problem, I would like point out that using tools from cygwin with vcpkg will sooner or later lead to mixing programs with different runtimes (Cygwin, MSYS2) which is discouraged (at least by MSYS2, forwarded in https://github.com/microsoft/vcpkg/blob/master/docs/users/mingw.md#how-to-avoid-mixing-different-installations). |
Beta Was this translation helpful? Give feedback.
-
Well, since vcpkg automatically downloads and use it's own portableGit version if it couldn't find a suitable git version the first time it's run, I don't see any good reason for not always use it's own version of git for consistency. Let's just imagine that someone installs the latest version of git which contains a breaking change (won't probably happen, but we never know), or a huge bug. Now that person installs a fresh vcpkg, and run it to install a port. Since it's the first run, vcpkg will check for the installed git version and will be happy with the one it found in the system. If everybody uses the same version of git for a given commitID of vcpkg, a lot of errors could be prevented. And I'm not even talking about mixing cygwin/msys2/powershell/wsl/whatever, just basic system installation for different users. |
Beta Was this translation helpful? Give feedback.
-
I would add that msys2 and cmake is already forced to vcpkg internal version, even if another version is already installed. I'm just suprised it's not the case for git... or maybe it was supposed to be the case and it's just a bug in the scripts. |
Beta Was this translation helpful? Give feedback.
-
FTR, for CMake and Ninja, there is already an variable to opt-in system binaries: |
Beta Was this translation helpful? Give feedback.
-
Hi, any progress on this issue? |
Beta Was this translation helpful? Give feedback.
-
Related to issue #9109. |
Beta Was this translation helpful? Give feedback.
-
Well, not entirely related. So I think that |
Beta Was this translation helpful? Give feedback.
-
I agree with @christophe-calmejane here; we should only use git from the system if we get |
Beta Was this translation helpful? Give feedback.
-
I think forcing our own copy of git would be ok if we do more to reduce its size |
Beta Was this translation helpful? Give feedback.
-
Hi, any progress on this issue? |
Beta Was this translation helpful? Give feedback.
-
@ras0219 if my understanding is correct, we could use our own git iff we can shrink the download from 40MB, right? |
Beta Was this translation helpful? Give feedback.
-
Well, why not let the end user decide? |
Beta Was this translation helpful? Give feedback.
-
I agree, fwiw; I would appreciate a |
Beta Was this translation helpful? Give feedback.
-
Describe the bug
The vcpkg_from_git command is affected by the user's environment. Based on the current running shell and the installed git version, installing a port might succeed or fail.
In my case, I'm running vcpkg either from cygwin, WSL or gitbash, and I don't get consistent results depending whether I have git installed or not, and which version of git.
The issue with vcpkg_from_git when using a SSH type URL, is that git must call SSH for the transport. If vcpkg detects that the system already have a suitable version of git installed (>= 2.26), it doesn't download the portableGit version and uses the system version of git. Probably due to PATH env cleanup or other env var being wiped by vcpkg execute_process call, calling git can cause errors like: ssh: No such file or directory
If my system does't have git installed or a git version too old (< 2.26) then vcpkg will automatically install portableGit and use this version, and the port will install correctly.
Environment
To Reproduce the environment issue
Steps to reproduce the behavior:
Alternatively instead of using cygwin, you can create a temporary folder anywhere, create a git.cmd file inside that just contains this line:
Then add this folder to your path: export PATH=pathToFolder:$PATH and run vcpkg install
To Reproduce the actual port error
Expected behavior
As vcpkg aims to not be affected at all my the user environment, I expect this to happen in all possible scenarios (cygwin, WSL, gitbash, or any other console subsystem) and be consistent. In case the user installed a corrupted or misbehaving git version, I expect vcpkg to run consistently.
I would expect vcpkg to always download and use it's own version of git, whether it found a suitable one or not in the system (that might or might not work correctly, even if it returned a suitable version from the git --version call).
Beta Was this translation helpful? Give feedback.
All reactions