-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Git network operations fail when libeay32.dll and/or ssleay32.dll exist in system folders #1086
Comments
My suggestion would be to place all of the libraries Git depends on in the same folder as the executable. I'm not sure if that is actually practical or not, but copying files around has resolved the issue for many users of Visual Studio 2017. |
Yeah, I've seen this before, too in other circumstances not related to Git for Windows when those DLLs are in the |
I have a experimental patch to move core Git's I will push this patch pending verification that it does fix the issue. |
Oh, and this patch is MinGit only, of course, as we already have code in the installer and in PortableGit's post-install script to hard-link/copy For the record: In the installer/portable Git, i do not want to move all those |
Whoops. |
I've started testing this but my environment isn't automated so it'll take a day or so. Some day I'll get time to automate this stuff. 😉 |
Thanks! |
MinGit [no longer gets distracted](git-for-windows/git#1086) by incompatible `libeay32.dll` versions in C:\Windows\system32. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
More applications need to be aware of the dangers of hierarchical library placements and System32 dynamic library injection. Especially when talking about crypto and security related libraries. |
@shiftkey that's unfortunately a MinGit-only solution. My idea to address this in the Portable Git is to simply just duplicate all What do you think? |
@dscho seems like that would work - I'm still curious about the idea of just statically linking everything. I get that git.exe would get massive, but I'm seeing a large-ish number of DLL loads for something as simple as Here's a procmon log of the command being run. Libeay32.dll gets loaded for this as well, which means if I place a 0-byte dll in my System32 folder Git is completely dead in the water. |
When installing .exe files into a different directory than their .dll dependencies, there is always a chance that a mismatching version of the same .dll in C:\WINDOWS\system32 is used. For that reason, we already have a post install script in place that tries to hardlink all .dll files from the bin directory into the libexec/git-core directory, falling back to copying them. However, this only works if the portable Git was installed using the self-extracting installer that executes that post install script, or if Git Bash was started at least once, or if the post install script was executed manually. We should do better than this: start with copied versions, and try to hard-link in the post install script if possible. This addresses git-for-windows/git#1086 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This took substantially longer than I hoped: 7-Zip was not smart enough to add only a couple of bytes, instead adding 4MB to the portable Git! I solved this by upgrading p7zip to the current version, which was unfortunately more involved than simply replacing the version string in the While at it, I now also use p7zip to package MinGit's Anyway, this ticket is now addressed. |
I did find a similar issue #1038, but it was incomplete in scope.
Setup
defaults?
to the issue you're seeing?
Only seen with Portable and MinGit packages. Doesn't seem to reproduce with installed instance of Git for Windows. Did not perform extensive testing honestly.
Details
None. Git is being launched directly from Visual Studio 2017.
Minimal, Complete, and Verifiable example
this will help us understand the issue.
Git to clone the repository from the remote URL to the local path.
Git exited with 128, because git-remote-https failed to correctly load the libeay32.dll and ssleay32.dll libraries. The load failure is caused by
LoadLibraryEx
. When an application asks Windows to load a library, Windows looks for a file with a matching name in a predictable pattern: local folder, system folder, folders on %PATH%.When a badly behaved installer places a copy of libeay32.dll and/or ssleay32.dll in the system folder, git-remote-https is tricked into loading the wrong library. This is because git-remote-https lives in the mingw32/libexec/git-core folder where as the libraries it depends on live in wingw32/bin and Window's
LoadLibraryEx
searches system folders first.URL to that repository to help us with testing?
It's an "always on feature" unfortunately.
The text was updated successfully, but these errors were encountered: