-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Best way to "run git for windows in wine" or "how to make use of git within pip from python under wine" #3478
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
Comments
Maybe running with |
With GIT_TRACE:
And with GIT_TRACE2_EVENT:
The commands where run within the built docker image whereas the errors in the first post where run during image creation. But I still have no clue :-( |
The clue is in the command that fails, |
Ok, you're definitely encountering a different error in those commands with trace output. It looks to me like one of the |
@rimrul Well it's a different error running the same sort of commands in two different environments a) docker build ... and b) docker run ... Im running wine from Debian Bullseye .. I'm not sure what Windows Version is emulated?
But to the suggestion of @dscho Running
the output is as follows
and then nothing happens till the connection is closed by the server. |
Likely two different bugs to chase and two different bugfixes. Probably at least one of them in Wines source.
According to their wiki that's Windows XP, unless configured otherwise. The installer should flat out refuse to install in that environment, though. |
@rimrul I tried to switch from winxp, to vista and win10 without any differences in the error messages. I used the Git Setup which does not install (unattended install without gui; building a docker image), the Portable version, the MinGit version and the tar.bz2 Archive - all with pretty the same errors. I tried the following:
and then issued the sub command:
This is with the version "Git-2.33.1-64-bit.tar.bz2" extracted manually. Any ideas? Should I use "vista" oder "win10" for the emulated setting in wine? Regards |
I fear that this has been reported e.g. as https://bugs.winehq.org/show_bug.cgi?id=40528, without any resolution I can see there. |
It looks as if TBBle/MSYS2-packages@375689d has a potential fix, I have no idea where this patch was/is on the way into MSYS2 or Cygwin, and honestly, this is such an edge case that I can't justify working on it more than I have. @mcfreis feel free to take it from here, rebuilding the MSYS2 runtime. You can easily rebuild the MSYS2 runtime via GitHub Actions, just
After the build is done, there will be an "install.zip" artifact containing the |
That page does talk about a patch in https://bugs.winehq.org/show_bug.cgi?id=48891 And quickly skimming that page, it sounds like the patch has made it into wine 6.11 So updating to a newer version of wine might help. |
I think this comment has a status summary: |
I'm narrowing it down but somehow loosing my target, which was "make a docker image based on Debian Bullseye with Wine, mingw-gcc and Python 3.7." The side effect is, that Python in Wine uses Git with Pip to install modules ... Ok, what have I done now? First installed Wine 6.19 from winehq-devel, switched to win10 emulation with winetricks and installed "Git for Windows" as follows:
What I the tried, is different protocols to clone, and the errors coe in when using ssh+git, so I tried plain ssh without success:
b2) with the patched msys-2.0.dll
I'm quite lost .... I believe the error lies in ssh included in "Git for Windows". But the patched msys-2.0.dll didn't help :-( |
I'm not quite sure on the details how pip and python modules work, but assuming they're pure python, could you side-step the whole issue by using debian pip and debian git to download the dependencies for windows python? |
@rimrul This could be possible on pure python modules, but not on win32 specific modules. Mixing it would be a mess. I managed to get a password prompt for |
Further investigation conclued to me, that it has to do with ssh. If I want to do an ssh connection where I'm asked any question, I cannot give input to the ssh client. I believe in the ssh client in usage with wine, there is some sort of error. |
You might be able to specify a custom askpass using the |
Alternatively you might have success with Mircrosofts OpenSSH instead of ours. |
It is probably set to (This is set in |
How would I do this? Install it in wine and then where to configure the usage within Git_for_Windows? |
You would download a |
Managed to make it work with OpenSSH-Win64 and the gitconfig core.sshCommand pointing to OpenSSH-Win64 -> git clone with ssh works in wine :-) Somehow I can't call Thanks all :-) |
The Problem now remains in the step
|
Does it work if you use |
It doesn't matter if I call Maybe the build environment from docker is missing something, that the later run environment has? Some variables or settings? |
Hmm. The stack trace suggests a Maybe call And maybe setting Also, is there any easy way for others to reproduce this? |
@dscho If cmd/git.exe or the other one makes no difference. To reproduce this, I created a repo Wine64-with-Git_for_Windows which builds the docker image, but fails in the last step because of the Null pointer access. May that help? |
Seems that I am currently unable to run Docker in my WSL2 instance. So I gave plain $ wine /mnt/c/git-sdk-64/cmd/git.exe version
it looks like wine32 is missing, you should install it.
multiarch needs to be enabled first. as root, please
execute "dpkg --add-architecture i386 && apt-get update &&
apt-get install wine32"
001e:err:module:attach_dlls "libiconv-2.dll" failed to initialize, aborting
001e:err:module:attach_dlls Initializing dlls for L"Z:\\mnt\\c\\git-sdk-64\\mingw64\\bin\\git.exe" failed, status c0000005 Not sure whether you can reproduce this in a minimal Docker configuration? |
And after installing $ wine /mnt/c/git-sdk-64/cmd/git.exe version
0020:err:module:attach_dlls "libiconv-2.dll" failed to initialize, aborting
0020:err:module:attach_dlls Initializing dlls for L"Z:\\mnt\\c\\git-sdk-64\\mingw64\\bin\\git.exe" failed, status c0000005 |
@dscho I think we need the docker subsystem for the error to be reproduced. Can you run |
Nope. I do have a WSL2 instance to test things with, but look here: $ docker build --progress=plain -t wine64-with-git_for_windows:1.0.0 -f Dockerfile .
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? and: $ sudo service docker start
docker: unrecognized service Apparently you have to install Windows Docker Desktop and jump through a couple of hoops, which I am not really willing to invest the time for, given that we are talking about a pretty fringe scenario ;-) |
@dscho I tried a few things last weekend although I couldn't reproduce your libiconv-2.dll error.
I believe it's an issue with the docker build environment vs. run environment. Thanks for all your help, I apreciate your effort. Thx. If I come up with a solution, I'll append it - but for now it has to suffice as it is. |
I hope you can get to the bottom of this. Let's leave the ticket open for now. |
I added Github Actions to build the docker image with the same results as if run locally. Maybe this helps for further analysis? |
Absolutely, it will make it possible to use But not right now. Right now, we're in the middle of the -rc phase, Git v2.34.0 is scheduled to appear this coming Monday. |
Oy, I fear I don't really have the resources to take care of this. @mcfreis could I talk you through building Git for Windows and/or OpenSSH and/or the MSYS2 runtime, adding tons of debug messages, and then investigating further? It is really frustrating and I am sorry that I won't be able to help more meaningfully. |
Hi, I'm running into a similar issue with git, but in my case, the command I'm running is echo "$(wine64 /cmd/git.exe --version 2>/dev/null)" and it outputs with a similar "coredump" as #3478 (comment) My situation is similar in that it's inside docker, but mine is using archlinux as the base and is using pacman to install msys2's packages, and then the packages from the "https://wingit.blob.core.windows.net/x86-64" repo on top of them. I tried using the packages provided in https://dev.azure.com/Git-for-Windows/git/_build/results?buildId=99619&view=artifacts&pathAsName=false&type=publishedArtifacts under coredump $ echo "$(wine64 /cmd/git.exe --version 2>/dev/null)"
Unhandled exception: page fault on write access to 0x0000000000000000 in 64-bit code (0x0000014027aa7b).
Register dump:
rip:000000014027aa7b rsp:000000000021f780 rbp:000000000000001c eflags:00010246 ( R- -- I Z- -P- )
rax:0000000000000000 rbx:0000000000000001 rcx:0000000000000000 rdx:0000000000000000
rsi:00000002a77ec020 rdi:00000002a77ec020 r8:000000007ebba590 r9:00000000000003fe r10:0000000000000008
r11:0000000000000246 r12:0000000000000000 r13:0000000000d60558 r14:0000000000000003 r15:0000000000d60528
Stack dump:
0x0000000021f780: 00000001c8e21b50 0000000140001540
0x0000000021f790: 0000000000000018 00000001c8e1d1d0
0x0000000021f7a0: 000000000021f7bc 000000017005ce47
0x0000000021f7b0: 00000000003318b0 000000107005b7fe
0x0000000021f7c0: 0000000000000000 0000000000000000
0x0000000021f7d0: 0000000000000000 0000000000000000
0x0000000021f7e0: 00000001c8e21a66 00000001402a3b90
0x0000000021f7f0: 0000000000335a90 0000000000d60498
0x0000000021f800: 0000000140001540 0000000000000018
0x0000000021f810: 00000001c8e1d1d0 00000001c8dc7328
0x0000000021f820: 0000000000000000 0000000000000000
0x0000000021f830: 000000000021f810 0000000000334e50
Backtrace:
=>0 0x0000014027aa7b detect_msys_tty+0x9b() in git (0x0000000000001c)
1 0x0000014027b921 winansi_init+0x241() in git (0x0000000000001c)
2 0x000001402797ea wmain+0x27a() in git (0x0000000000001c)
3 0x000001400013d4 __tmainCRTStartup+0x254() in git (0x00000000d60498)
4 0x00000140001506 mainCRTStartup+0x16() in git (0000000000000000)
5 0x0000007b62bc39 ActivateActCtx+0x20081() in kernel32 (0000000000000000)
6 0x0000017005d263 A_SHAFinal+0x3a6a3() in ntdll (0000000000000000)
0x0000014027aa7b detect_msys_tty+0x9b in git: movw %dx,(%r12,%rax,2)
Modules:
Module Address Debug info Name (44 modules)
PE 000000007b000000-000000007b24d000 Deferred kernelbase
PE 000000007b600000-000000007b65e000 Export kernel32
ELF 000000007d000000-000000007d005000 Deferred <wine-loader>
PE 0000000140000000-000000014039d000 PDB git
PE 0000000170000000-00000001700a0000 Export ntdll
PE 00000001c8db0000-00000001c8e47000 Deferred msvcrt
PE 00000001ec2b0000-00000001ec2d6000 Deferred ws2_32
PE 0000000214d20000-0000000214e2b000 Deferred libiconv-2
PE 00000002209f0000-0000000220a18000 Deferred libintl-8
PE 00000002330a0000-0000000233143000 Deferred libpcre2-8-0
PE 000000023d820000-000000023d9ee000 Deferred user32
PE 0000000241b90000-0000000241bb4000 Deferred zlib1
PE 000000026b4c0000-000000026b53b000 Deferred gdi32
PE 00000002a77e0000-00000002a77f2000 Deferred libssp-0
PE 00000002f1fa0000-00000002f1fad000 Deferred version
PE 000000032a700000-000000032a729000 Deferred sechost
PE 0000000330260000-000000033029f000 Deferred advapi32
PE 0000000375610000-0000000375649000 Deferred win32u
PE 00000003af670000-00000003af730000 Deferred ucrtbase
PE 00000003afd00000-00000003afd1a000 Deferred imm32
ELF 00007f4aa3fc3000-00007f4aa3ff4000 Deferred libexpat.so.1
ELF 00007f4aa3ff4000-00007f4aa4044000 Deferred libfontconfig.so.1
ELF 00007f4aa4044000-00007f4aa40bb000 Deferred libpcre.so.1
ELF 00007f4aa40bb000-00007f4aa41f9000 Deferred libglib-2.0.so.0
ELF 00007f4aa41f9000-00007f4aa421b000 Deferred libgraphite2.so.3
ELF 00007f4aa421b000-00007f4aa4304000 Deferred libharfbuzz.so.0
ELF 00007f4aa4304000-00007f4aa433b000 Deferred libpng16.so.16
ELF 00007f4aa433b000-00007f4aa434e000 Deferred libbz2.so.1.0
ELF 00007f4aa434e000-00007f4aa441d000 Deferred libfreetype.so.6
ELF 00007f4aa441d000-00007f4aa4440000 Deferred libbrotlicommon.so.1
ELF 00007f4aa4440000-00007f4aa4445000 Deferred libpthread.so.0
ELF 00007f4aa4445000-00007f4aa444a000 Deferred libdl.so.2
ELF 00007f4aa444a000-00007f4aa4456000 Deferred libffi.so.8
ELF 00007f4aa481c000-00007f4aa482a000 Deferred libbrotlidec.so.1
ELF 00007f4aa48cf000-00007f4aa4a02000 Deferred libp11-kit.so.0
ELF 00007f4aa4a02000-00007f4aa4a1c000 Deferred libz.so.1
ELF 00007f4aa4c35000-00007f4aa4d1c000 Deferred libm.so.6
ELF 00007f4aa4d1c000-00007f4aa4ea7000 Deferred win32u.so
ELF 00007f4aa51a7000-00007f4aa531e000 Dwarf libwine.so.1
ELF 00007f4aa5707000-00007f4aa5731000 Deferred liblzma.so.5
ELF 00007f4aa5731000-00007f4aa574b000 Deferred libunwind.so.8
ELF 00007f4aa574b000-00007f4aa580b000 Deferred ntdll.so
ELF 00007f4aa5a29000-00007f4aa5a2f000 Deferred ws2_32.so
ELF 00007f4aa5a2f000-00007f4aa5a68000 Deferred ld-linux-x86-64.so.2
Threads:
process tid prio name (all IDs are in hex)
00000020 start.exe
["C:\windows\system32\start.exe" /exec /cmd/git.exe --version]
00000024 0
00000038 services.exe
["C:\windows\system32\services.exe"]
0000003c 0
00000040 0
00000054 0
00000058 0
00000074 0
0000008c 0
000000a4 0
000000bc 0
000000d4 0
00000044 winedevice.exe
[C:\windows\system32\winedevice.exe]
00000048 0
0000005c 0
00000060 0
00000064 0
000000c8 0
0000004c explorer.exe
["C:\windows\system32\explorer.exe" /desktop]
00000050 0
00000084 0
0000006c winedevice.exe
[C:\windows\system32\winedevice.exe]
00000070 0
00000078 0
0000007c 0
00000080 0
00000090 0
00000094 0
00000098 0
0000009c plugplay.exe
[C:\windows\system32\plugplay.exe]
000000a0 0
000000a8 0
000000ac 0
000000b0 0
000000b4 svchost.exe
[C:\windows\system32\svchost.exe -k LocalServiceNetworkRestricted]
000000b8 0
000000c0 0
000000c4 0
000000cc rpcss.exe
[C:\windows\system32\rpcss.exe]
000000d0 0
000000d8 0
000000dc 0
000000e0 0
000000e4 0
000000e8 0
000000ec 0
00000120 0
000000f0 conhost.exe
["C:\windows\system32\conhost.exe" --unix --width 0 --height 0 --server 0x34]
000000f4 0
000000f8 git.exe
["Z:\cmd\git.exe" --version]
000000fc 0
00000100 (D) Z:\mingw64\bin\git.exe
[git.exe --version]
00000104 0 <==
00000110 0
00000114 explorer.exe
["C:\windows\system32\explorer.exe" /desktop]
00000118 0
0000011c 0
System information:
Wine build: wine-7.7 (Staging)
Platform: x86_64
Version: Windows 7
Host system: Linux
Host version: 5.18.0-1-MANJARO I will try to see if I can follow the guide at https://github.com/git-for-windows/git/wiki/Building-Git to build a full debug version to see if I could potentially get the exact line it's failing at, but I am not sure how to really debug with wine, especially when trying to debug a command that only crashes under specific circumstances (only stderr redirected to anything (stdout redirected doesn't trigger this) and this only occurs when I run it inside a subshell) |
Since I was a bit impatient, I decided to try to dissect #include <stdio.h>
#include <io.h>
#include <windows.h>
#include <winternl.h>
#include <ntstatus.h>
static int fd_is_interactive[3] = {0, 0, 0};
#define FD_CONSOLE 0x1
#define FD_SWAPPED 0x2
#define FD_MSYS 0x4
static void detect_msys_tty(int fd) {
ULONG result;
BYTE buffer[1024];
POBJECT_NAME_INFORMATION nameinfo = (POBJECT_NAME_INFORMATION)buffer;
PWSTR name;
printf("detect_msys_tty(%d)\n", fd);
/* check if fd is a pipe */
HANDLE h = (HANDLE)_get_osfhandle(fd);
printf("got here 1\n");
if (GetFileType(h) != FILE_TYPE_PIPE)
return;
printf("got here 2\n");
/* get pipe name */
if (!NT_SUCCESS(NtQueryObject(h, ObjectNameInformation, buffer, sizeof(buffer) - 2, &result)))
return;
printf("got here 3: %p %u\n", nameinfo->Name.Buffer, nameinfo->Name.Length);
name = nameinfo->Name.Buffer;
name[nameinfo->Name.Length / sizeof(*name)] = 0;
/*
* Check if this could be a MSYS2 pty pipe ('msys-XXXX-ptyN-XX')
* or a cygwin pty pipe ('cygwin-XXXX-ptyN-XX')
*/
if ((!wcsstr(name, L"msys-") && !wcsstr(name, L"cygwin-")) || !wcsstr(name, L"-pty"))
return;
printf("got here 4\n");
if (fd == 2) {
printf("got here 5\n");
setvbuf(stderr, NULL, _IONBF, BUFSIZ);
}
printf("got here 6\n");
fd_is_interactive[fd] |= FD_MSYS;
}
int main() {
detect_msys_tty(0);
detect_msys_tty(1);
detect_msys_tty(2);
} echo "$(./a.exe 2>/dev/null)"
detect_msys_tty(0)
got here 1
detect_msys_tty(1)
got here 1
got here 2
got here 3: 0000000000000000 0
Unhandled exception: page fault on write access to 0x0000000000000000 in 64-bit code (0x000001400016a0).
Register dump:
rip:00000001400016a0 rsp:000000000021f8c0 rbp:000000000021f940 eflags:00010246 ( R- -- I Z- -P- ) the issue seems to be that wine isn't properly filling out the Name.Buffer and Name.Length field inside I think the smallest fix would be diff --git a/compat/winansi.c b/compat/winansi.c
index 3abe8dd5a2..855897e6dd 100644
--- a/compat/winansi.c
+++ b/compat/winansi.c
@@ -573,6 +573,8 @@ static void detect_msys_tty(int fd)
if (!NT_SUCCESS(NtQueryObject(h, ObjectNameInformation,
buffer, sizeof(buffer) - 2, &result)))
return;
+ if (result <= sizeof(*nameinfo))
+ return;
name = nameinfo->Name.Buffer;
name[nameinfo->Name.Length / sizeof(*name)] = 0;
based on looking at wine's code since it sets @dscho would that be an acceptable bandaid for now? Or could there be a better option? |
Thank you for reverting the phishing attempt on the wiki!
Awesome analysis, and thank you for being so responsive in #3875! I've since merged it and the latest snapshot has the fix. Could I ask you to verify the fix? |
I've pulled the pacman suitable packages from https://dev.azure.com/Git-for-Windows/git/_build/results?buildId=100237&view=artifacts&pathAsName=false&type=publishedArtifacts since it has the same commit hash as the latest snapshot. Using the RUN git.exe clone https://gitlab.com/AOMediaCodec/SVT-AV1.git && \
cmake.exe -B bui -S SVT-AV1/ -GNinja -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF && \
ninja.exe -C bui and the echo command of [root@db8cdc4507b9 /]# echo $(wine64 git.exe --version 2>/dev/null)
git version 2.36.1.windows.1.14.gc5ca16f7d9.20220530182759 works with no issue |
Right now, I'm facing a bit of a different issue with [root@db8cdc4507b9 SVT-AV1]# git clone $PWD temp
Cloning into 'temp'...
Skipping command-line '"Z:\usr\bin\..\usr\bin\bash.exe"'
('Z:\usr\bin\..\usr\bin\bash.exe' not found)
Need a valid command-line; Edit the string resources accordingly
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists. but that seems to be a bash.exe issue [root@db8cdc4507b9 SVT-AV1]# bash.exe -l
Skipping command-line '"Z:\usr\bin\..\usr\bin\bash.exe"'
('Z:\usr\bin\..\usr\bin\bash.exe' not found)
Need a valid command-line; Edit the string resources accordingly so it is unrelated to this issue, and I presume git-for-windows |
Which |
I can only presume it was trying to find |
Well, if your |
Considering that inside the arch container, |
Seems a lot of things in arch rely on |
[root@d107ecdaa845 /]# command -v bash.exe
/usr/sbin/bash.exe
[root@d107ecdaa845 /]# bash.exe -c 'echo 1'
Cygwin WARNING:
Couldn't compute FAST_CWD pointer. This typically occurs if you're using
an older Cygwin version on a newer Windows. Please update to the latest
available Cygwin version from https://cygwin.com/. If the problem persists,
please see https://cygwin.com/problems.html
1
[root@d107ecdaa845 /]# git.exe clone https://gitlab.com/AOMediaCodec/SVT-AV1.git
Cloning into 'SVT-AV1'...
remote: Enumerating objects: 41498, done.
remote: Counting objects: 100% (3125/3125), done.
remote: Compressing objects: 100% (780/780), done.
remote: Total 41498 (delta 2364), reused 3074 (delta 2323), pack-reused 38373
Receiving objects: 100% (41498/41498), 56.30 MiB | 39.17 MiB/s, done.
Resolving deltas: 100% (32262/32262), done.
[root@d107ecdaa845 /]# cd SVT-AV1/
[root@d107ecdaa845 SVT-AV1]# git clone $PWD svtav1-src
Cloning into 'svtav1-src'...
Cygwin WARNING:
Couldn't compute FAST_CWD pointer. This typically occurs if you're using
an older Cygwin version on a newer Windows. Please update to the latest
available Cygwin version from https://cygwin.com/. If the problem persists,
please see https://cygwin.com/problems.html
done.
[root@d107ecdaa845 SVT-AV1]# ls svtav1-src/
Build CHANGELOG.md CMakeLists.txt Config CONTRIBUTING.md Dockerfile Docs ffmpeg_plugin gstreamer-plugin LICENSE-BSD2.md LICENSE.md PATENTS.md README.md snap Source STYLE.md test third_party
Okay, that got it to work, thanks! Going to run a ffmpeg build with a few external libraries to see if I encounter any more unique issues with git.exe |
Well, I found an issue, I'm not sure if it's necessarily git-for-windows's fault, but I'm just going to open a new issue instead of tagging on this one since I think the base issue was fixed |
This here ticket was mentioned in https://www.msys2.org/docs/faq/#how-can-i-get-msys2-running-under-wine |
As described in the subject, I'm in need of a git client under wine. I use wine with python 3.7 and pip to build python applications for Windows on a Linux host.
I tried the MinGit-2.33.1-64-bit.zip and the Installer-Version and the Portable one but without success.
Do you have any suggestions?
Example error:
The text was updated successfully, but these errors were encountered: