Open mcfreis opened 3 years ago
Maybe running with GIT_TRACE
or GIT_TRACE2_EVENT
might shed more light into this? I could imagine that something is going wrong with ASLR, though.
With GIT_TRACE:
root@242fe770ca31:~# GIT_TRACE=true wine git clone ssh://git@gitlab-prod.****:2222/rnd-team/pytools/srmocklab.
git
06:09:01.132606 exec-cmd.c:237 trace: resolved executable dir: C:/mingit/mingw64/bin
06:09:01.133686 git.c:455 trace: built-in: git clone ssh://git@gitlab-prod.****:2222/rnd-team/pytools/srmocklab.git
Cloning into 'srmocklab'...
06:09:01.165115 run-command.c:666 trace: run_command: unset GIT_DIR; GIT_PROTOCOL=version=2 ssh -o SendEnv=GIT_PROTOCOL -p 2222 git@gitlab-prod.**** 'git-upload-pack '\''/rnd-team/pytools/srmocklab.git'\'''
BUG: compat/mingw.c:138: err_win_to_posix() called without an error!
abnormal program termination
root@242fe770ca31:~#
And with GIT_TRACE2_EVENT:
root@242fe770ca31:~# GIT_TRACE2_EVENT=true wine git clone ssh://git@gitlab-prod.****:2222/rnd-team/pytools/srmocklab.git
{"event":"version","sid":"20211019T061036.227597Z-H086aa3a8-P0000002b","thread":"main","time":"2021-10-19T06:10:36.227624Z","file":"common-main.c","line":48,"evt":"2","exe":"2.33.1.windows.1"}
{"event":"start","sid":"20211019T061036.227597Z-H086aa3a8-P0000002b","thread":"main","time":"2021-10-19T06:10:36.227754Z","file":"common-main.c","line":49,"t_abs":0.002166,"argv":["git.exe","clone","ssh://git@gitlab-prod.****:2222/rnd-team/pytools/srmocklab.git"]}
{"event":"data_json","sid":"20211019T061036.227597Z-H086aa3a8-P0000002b","thread":"main","time":"2021-10-19T06:10:36.250496Z","file":"compat/win32/trace2_win32_process_info.c","line":118,"repo":0,"t_abs":0.024905,"t_rel":0.024905,"nesting":1,"category":"process","key":"windows/ancestry","value":["git.exe"]}
{"event":"cmd_name","sid":"20211019T061036.227597Z-H086aa3a8-P0000002b","thread":"main","time":"2021-10-19T06:10:36.250765Z","file":"git.c","line":456,"name":"clone","hierarchy":"clone"}
{"event":"def_repo","sid":"20211019T061036.227597Z-H086aa3a8-P0000002b","thread":"main","time":"2021-10-19T06:10:36.253124Z","file":"repository.c","line":132,"repo":1,"worktree":"Z:/root/srmocklab"}
Cloning into 'srmocklab'...
{"event":"child_start","sid":"20211019T061036.227597Z-H086aa3a8-P0000002b","thread":"main","time":"2021-10-19T06:10:36.285852Z","file":"run-command.c","line":738,"child_id":0,"child_class":"transport/ssh","use_shell":false,"argv":["ssh","-o","SendEnv=GIT_PROTOCOL","-p","2222","git@gitlab-prod.****","git-upload-pack '/rnd-team/pytools/srmocklab.git'"]}
BUG: compat/mingw.c:138: err_win_to_posix() called without an error!
{"event":"error","sid":"20211019T061036.227597Z-H086aa3a8-P0000002b","thread":"main","time":"2021-10-19T06:10:36.286784Z","file":"usage.c","line":279,"msg":"err_win_to_posix() called without an error!","fmt":"err_win_to_posix() called without an error!"}
abnormal program termination
root@242fe770ca31:~#
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, ssh
. Maybe the problem will reproduce if you call that command directly rather than via git clone
.
Ok, you're definitely encountering a different error in those commands with trace output.
It looks to me like one of the CreateProcessW()
calls in mingw_spawnve_fd()
failed, but the following GetLastError()
call returned ERROR_SUCCESS
. Since you said you tried the installed version, I assume your wineprefix is set up to emulate at least Vista, right?
@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?
wine-5.0.3 (Debian 5.0.3-3)
But to the suggestion of @dscho
Running
unset GIT_CONFIG_PARAMETERS GIT_DIR; GIT_PROTOCOL=version=2 ssh -o SendEnv=GIT_PROTOCOL -p 2222 git@gitlab-prod.*** 'git-upload-pack '\''/rnd-team/pytools/tchpy3lib.git'\'''
the output is as follows
Warning: Permanently added '[gitlab-prod.****]:2222,[10.***]:2222' (ECDSA) to the list of known hosts.
000eversion 2
0015agent=git/2.31.1
0013ls-refs=unborn
0019fetch=shallow filter
0012server-option
0017object-format=sha1
0000
and then nothing happens till the connection is closed by the server.
@rimrul Well it's a different error running the same sort of commands in two different environments a) docker build ... and b) docker run ...
Likely two different bugs to chase and two different bugfixes. Probably at least one of them in Wines source.
Im running wine from Debian Bullseye .. I'm not sure what Windows Version is emulated?
wine-5.0.3 (Debian 5.0.3-3)
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:
root@602217c6ead4:~/build# GIT_TRACE=true wine git -c http.sslVerify=false clone ssh://git@gitlab-prod.****:2222/rnd-team/pytools/tchpy3lib.git
07:58:43.401958 exec-cmd.c:237 trace: resolved executable dir: C:/git/mingw64/bin
07:58:43.403221 git.c:455 trace: built-in: git clone ssh://git@gitlab-prod.****:2222/rnd-team/pytools/tchpy3lib.git
Cloning into 'tchpy3lib'...
07:58:43.436147 run-command.c:666 trace: run_command: unset GIT_CONFIG_PARAMETERS GIT_DIR; GIT_PROTOCOL=version=2 ssh -o SendEnv=GIT_PROTOCOL -p 2222 git@gitlab-prod.**** 'git-upload-pack '\''/rnd-team/pytools/tchpy3lib.git'\'''
BUG: compat/mingw.c:138: err_win_to_posix() called without an error!
and then issued the sub command:
root@602217c6ead4:~/build# unset GIT_CONFIG_PARAMETERS GIT_DIR; GIT_PROTOCOL=version=2 wine ssh -o SendEnv=GIT_PROTOCOL -p 2222 git@gitlab-prod.**** 'git-upload-pack '\''/rnd-team/pytools/tchpy3lib.git'\'''
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
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
Couldn't compute FAST_CWD pointer.
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 https://github.com/TBBle/MSYS2-packages/commit/375689d69776fa54a1262439c26c1e2dffdf8c42 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 msys-2.0.dll
you need to copy into your setup for testing.
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.
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.
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
I think this comment has a status summary:
https://github.com/msys2/MSYS2-packages/issues/682#issuecomment-437972861
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: a) Tried Git-2.33.1-64-bit.exe without success ... installation does not finish, abort with ctrl-c. b) Used MinGit-2.33.1-64-bit.zip, unzipped it, added the paths to the environment and used once the original msys-2.0.dll and the newly built msys-2.0.dll (as described by @dscho ). Both fail:
root@8f318f305d55:~/build# wine git clone ssh://git@gitlab-prod.****:2222/rnd-team/pytools/tchpy3lib.git
0044:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded.
0044:err:winediag:nodrv_CreateWindow Make sure that your X server is running and that $DISPLAY is set correctly.
0044:err:systray:initialize_systray Could not create tray window
Cloning into 'tchpy3lib'...
010c:fixme:ntdll:NtSetInformationToken unimplemented class 4
010c:fixme:virtual:NtAllocateVirtualMemoryEx Ignoring 1 extended parameters 0x21fcd0
010c:fixme:security:GetWindowsAccountDomainSid (00007FFFFFDAC170 000000000024AED8 00007FFFFFDAC16C): semi-stub
010c:fixme:netapi32:DsEnumerateDomainTrustsW ((null), 0x0023, 00007FFFFFDAC348, 00007FFFFFDAC334): stub
0114:fixme:wldap32:ldap_set_optionA Unsupported option: 0x95
0114:fixme:wldap32:ldap_set_optionA Unsupported option: 0x96
010c:fixme:netapi32:NetUserGetInfo Only implemented for local computer, but remote serverL"\\\\@" was requested.
010c:fixme:winsock:addrinfo_flags_to_unix unhandled flags 0x80000
010c:fixme:winsock:addrinfo_flags_to_unix unhandled flags 0x80000
Warning: Permanently added '[gitlab-prod.****]:2222' (ED25519) to the list of known hosts.
010c:err:virtual:virtual_setup_exception stack overflow 976 bytes in thread 010c addr 0x7bc5273c stack 0x7fffffbb0c30 (0x7fffffbb0000-0x7fffffbb1000-0x7fffffdb0000)
^C012c:fixme:console:default_ctrl_handler Terminating process 20 on event 0
root@8f318f305d55:~/build#
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: b1) with the original msys-2.0.dll
root@f9e2cc0ede0c:~/build# wine ssh tfb@as-swdevdev-p1
0164:fixme:ntdll:NtSetInformationToken unimplemented class 4
0164:fixme:virtual:NtAllocateVirtualMemoryEx Ignoring 1 extended parameters 0x21fcd0
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
0164:fixme:security:GetWindowsAccountDomainSid (00007FFFFFDAC080 00000000002497E8 00007FFFFFDAC07C): semi-stub
0164:fixme:netapi32:DsEnumerateDomainTrustsW ((null), 0x0023, 00007FFFFFDAC258, 00007FFFFFDAC244): stub
016c:fixme:wldap32:ldap_set_optionA Unsupported option: 0x95
016c:fixme:wldap32:ldap_set_optionA Unsupported option: 0x96
0164:fixme:netapi32:NetUserGetInfo Only implemented for local computer, but remote serverL"\\\\@" was requested.
0164:fixme:winsock:addrinfo_flags_to_unix unhandled flags 0x80000
0164:fixme:winsock:addrinfo_flags_to_unix unhandled flags 0x80000
Warning: Permanently added 'as-swdevdev-p1' (ED25519) to the list of known hosts.
0164:err:virtual:virtual_setup_exception stack overflow 848 bytes in thread 0164 addr 0x7bc5273c stack 0x7fffffbb0cb0 (0x7fffffbb0000-0x7fffffbb1000-0x7fffffdb0000)
^C0178:fixme:console:default_ctrl_handler Terminating process 150 on event 0
root@f9e2cc0ede0c:~/build#
b2) with the patched msys-2.0.dll
root@ea8cdebd5199:~/build# wine ssh tfb@as-swdevdev-p1
0044:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded.
0044:err:winediag:nodrv_CreateWindow Make sure that your X server is running and that $DISPLAY is set correctly.
0044:err:systray:initialize_systray Could not create tray window
Application could not be started, or no application associated with the specified file.
ShellExecuteEx failed: File not found.
root@ea8cdebd5199:~/build#
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 wine ssh user@host
after changing Wine emulation to vista
but the password input is echoed back and nothing else happens :-( If I supply the password in the URL, the clone works. Somehow the stdin from ssh receives nothing ...
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 SSH_ASKPASS
environment variable.
Alternatively you might have success with Mircrosofts OpenSSH instead of ours.
You might be able to specify a custom askpass using the
SSH_ASKPASS
environment variable.
It is probably set to /mingw64/bin/git-askpass.exe
, which is a GUI-only program. Use unset SSH_ASKPASS
to clear that setting.
(This is set in /etc/profile.d/env.sh
, if you want to build a Docker image, it would probably make sense to either edit that file, or to add a ~/.bash_profile
that unsets it.)
Alternatively you might have success with Mircrosofts OpenSSH instead of ours.
How would I do this? Install it in wine and then where to configure the usage within Git_for_Windows?
Alternatively you might have success with Mircrosofts OpenSSH instead of ours.
How would I do this? Install it in wine and then where to configure the usage within Git_for_Windows?
You would download a .zip
from https://github.com/PowerShell/Win32-OpenSSH/releases/, extract it, and set core.sshCommand
to point to the ssh.exe
.
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 wine $WINEPREFIX/drive_c/git/bin/git.exe config --system --add core.sshCommand "C:/OpenSSH-Win64/ssh.exe"
- it crashes with the same error picture as in post 1 - but that is another story.
Thanks all :-)
The Problem now remains in the step docker build -f Dockerfile .
with the message:
> [33/33] RUN true && GIT_TRACE=true wine /root/.wine64/drive_c/git/bin/git.exe config --system --add core.sshCommand "C:/OpenSSH-Win64/ssh.exe":
#37 1.287 wine: Unhandled page fault on write access to 0000000000000000 at address 00000001402616EB (thread 00fc), starting debugger...
#37 1.454 Unhandled exception: page fault on write access to 0x00000000 in 64-bit code (0x00000001402616eb).
#37 1.474 Register dump:
#37 1.474 rip:00000000402616eb rsp:000000000021f780 rbp:0000000000000049 eflags:00010246 ( R- -- I Z- -P- )
#37 1.474 rax:0000000000000000 rbx:0000000000000000 rcx:0000000000000000 rdx:0000000000000000
#37 1.474 rsi:00000000a77ec020 rdi:00000000a77ec020 r8:000000000023f850 r9:00000000000003fe r10:0000000000000008
#37 1.474 r11:0000000000000246 r12:0000000000000000 r13:0000000000ad06e8 r14:0000000000000007 r15:0000000000ad0628
#37 1.474 Stack dump:
#37 1.474 0x000000000021f780: 000000006a0ec1d0 0000000067fe0000
#37 1.474 0x000000000021f790: 0000000000ad0498 000000006a0f0d10
#37 1.475 0x000000000021f7a0: 000000000021f7bc 0000000000000000
#37 1.475 0x000000000021f7b0: 0000000000000000 000000007bc56b95
#37 1.476 0x000000000021f7c0: 0000000000000000 0000000000000000
#37 1.476 0x000000000021f7d0: 0000000000000000 0000000000000000
#37 1.476 0x000000000021f7e0: 0000000000000000 0000000040292b7d
#37 1.477 0x000000000021f7f0: 000000000021f7d0 000000006a0f0c26
#37 1.477 0x000000000021f800: 00000000402945b0 0000000000245450
#37 1.477 0x000000000021f810: 0000000000ad0498 0000000040001540
#37 1.478 0x000000000021f820: 0000000000000038 000000006a097168
#37 1.478 0x000000000021f830: 0000000000000000 000000000000000b
#37 1.478 Backtrace:
#37 1.478 =>0 0x00000001402616eb in git (+0x2616eb) (0x0000000000000049)
#37 1.478 1 0x0000000140262527 in git (+0x262526) (0x0000000000000049)
#37 1.478 2 0x000000014026045a in git (+0x260459) (0x0000000000000049)
#37 1.478 3 0x00000001400013d4 in git (+0x13d3) (0x0000000000ad0498)
#37 1.478 4 0x0000000140001506 in git (+0x1505) (0x0000000000000000)
#37 1.502 5 0x000000007b62c659 BaseThreadInitThunk+0x8(unknown=<is not available>, entry=<is not available>, arg=<is not available>) [Z:\usr\src\packages\BUILD\dlls\kernel32\thread.c:61] in kernel32 (0x0000000000000000)
#37 1.550 6 0x000000007bc56fa3 RtlUserThreadStart+0x82(entry=00000001400014F0, arg=0000000067FF0000) [Z:\usr\src\packages\BUILD\dlls\ntdll\thread.c:241] in ntdll (0x0000000000000000)
#37 1.551 0x00000001402616eb: movw %dx,(%r12,%rax,2)
#37 1.551 Modules:
#37 1.551 Module Address Debug info Name (21 modules)
#37 1.551 PE 61540000- 6162f000 Deferred advapi32
#37 1.551 PE 62dc0000- 62fc4000 Deferred rpcrt4
#37 1.551 PE 63280000- 6329b000 Deferred version
#37 1.551 PE 66900000- 66959000 Deferred win32u
#37 1.551 PE 6a080000- 6a2e5000 Deferred msvcrt
#37 1.551 PE 6ba00000- 6ba94000 Deferred sechost
#37 1.551 PE 6bac0000- 6bc3e000 Deferred setupapi
#37 1.551 PE 6c7c0000- 6c9b9000 Deferred gdi32
#37 1.551 PE 6d580000- 6d5fb000 Deferred ws2_32
#37 1.551 PE 6eb00000- 6f18b000 Deferred user32
#37 1.551 PE 70940000- 70c03000 Deferred ucrtbase
#37 1.551 PE 71000000- 7104d000 Deferred imm32
#37 1.551 PE 7b000000- 7b30c000 Deferred kernelbase
#37 1.551 PE 7b600000- 7b91a000 Dwarf-2 kernel32
#37 1.551 PE 7bc00000- 7be65000 Dwarf-2 ntdll
#37 1.551 PE 140000000- 140388000 Export git
#37 1.551 PE 214d20000- 214e2b000 Deferred libiconv-2
#37 1.551 PE 2209f0000- 220a18000 Deferred libintl-8
#37 1.551 PE 2330a0000- 23313e000 Deferred libpcre2-8-0
#37 1.551 PE 241b90000- 241bb4000 Deferred zlib1
#37 1.551 PE 2a77e0000- 2a77f2000 Deferred libssp-0
#37 1.552 Threads:
#37 1.555 process tid prio (all id:s are in hex)
#37 1.556 00000020 start.exe
#37 1.556 00000024 0
#37 1.558 00000030 winemenubuilder.exe
#37 1.558 00000034 0
#37 1.561 00000038 services.exe
#37 1.561 0000003c 0
#37 1.561 00000048 0
#37 1.562 00000054 0
#37 1.562 00000058 0
#37 1.562 00000078 0
#37 1.563 0000007c 0
#37 1.563 00000088 0
#37 1.563 000000a4 0
#37 1.564 000000bc 0
#37 1.564 000000d4 0
#37 1.567 00000040 explorer.exe
#37 1.567 00000044 0
#37 1.567 00000070 0
#37 1.570 0000004c winedevice.exe
#37 1.570 00000050 0
#37 1.570 0000005c 0
#37 1.571 00000060 0
#37 1.571 000000c8 0
#37 1.574 00000068 winedevice.exe
#37 1.574 0000006c 0
#37 1.575 00000080 0
#37 1.575 00000084 0
#37 1.575 0000008c 0
#37 1.576 00000090 0
#37 1.576 00000094 0
#37 1.577 00000098 0
#37 1.580 0000009c plugplay.exe
#37 1.580 000000a0 0
#37 1.580 000000a8 0
#37 1.580 000000ac 0
#37 1.581 000000b0 0
#37 1.584 000000b4 svchost.exe
#37 1.584 000000b8 0
#37 1.584 000000c0 0
#37 1.584 000000c4 0
#37 1.587 000000cc rpcss.exe
#37 1.587 000000d0 0
#37 1.587 000000d8 0
#37 1.587 000000dc 0
#37 1.588 000000e0 0
#37 1.588 000000e4 0
#37 1.588 000000e8 0
#37 1.588 000000ec 0
#37 1.592 000000f0 git.exe
#37 1.592 000000f4 0
#37 1.592 000000f8 (D) C:\git\mingw64\bin\git.exe
#37 1.592 000000fc 0 <==
#37 1.592 00000108 0
#37 1.593 System information:
#37 1.593 Wine build: wine-6.19
#37 1.593 Platform: x86_64
#37 1.593 Version: Windows Vista
#37 1.593 Host system: Linux
#37 1.593 Host version: 5.10.16.3-microsoft-standard-WSL2
------
executor failed running [/bin/sh -c true && GIT_TRACE=true wine $WINEPREFIX/drive_c/git/bin/git.exe config --system --add core.sshCommand "C:/OpenSSH-Win64/ssh.exe"]: exit code: 5
GIT_TRACE=true
didn't show anything useful. Any ideas how to dig into this?
Does it work if you use --global
instead of --system
?
Does it work if you use
--global
instead of--system
?
It doesn't matter if I call wine git
or wine git clone
or wine git --version
or wine git config --global
, all show the same dump.
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 NULL
pointer access, which is bad.
Maybe call cmd/git.exe
instead of mingw64/bin/git.exe
?
And maybe setting GIT_TRACE2_EVENT
to a file path, and then inspecting the last few lines, shines more light on this bug?
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
a try in my Ubuntu 18.04, and it says this:
$ 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 win32
as suggested, I get this, of course:
$ 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 docker build
within a Linux distro? I'll try to night.
Can you run
docker build
within a Linux distro?
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.
1) Native Ubuntu LTS with Winehq-Devel and Git_for_windows (+ patched msys-2.0.dll) and the OpenSSH-win64 works fine.
2) With the docker build within the Native Ubuntu LTS, I receive the same crash as in post.
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.
https://github.com/mcfreis/Wine64-with-Git_for_Windows/runs/4165186134?check_suite_focus=true
Maybe this helps for further analysis?
Maybe this helps for further analysis?
Absolutely, it will make it possible to use tmate
to debug this, directly on the build agent.
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 https://github.com/git-for-windows/git/issues/3478#issuecomment-949571769
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 pkg-x86_64
to get a non-stripped version of git.exe and got this as my "coredump" output
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 detect_msys_tty()
on its own using classic printf debugging, and lo and behold,
#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 NtQueryObject()
, or git isn't checking that properly or is using the function properly, which does strike me weird looking at https://docs.microsoft.com/en-us/windows/win32/api/winternl/nf-winternl-ntqueryobject and not seeing ObjectNameInformation
anywhere, but it does seem to be documented elsewhere, just not on their docs.
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 result
to 16 in the case of no name
@dscho would that be an acceptable bandaid for now? Or could there be a better option?
I will try to see if I can follow the guide at https://github.com/git-for-windows/git/wiki/Building-Git
Thank you for reverting the phishing attempt on the wiki!
@dscho would that be an acceptable bandaid for now? Or could there be a better option?
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?
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 /cmd/git.exe
and co from that package, I can confirm that both the use case of git clone
from inside the dockerfile as
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
[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
Which bash.exe
does this try to find?
I can only presume it was trying to find /usr/bin/bash.exe
from git-for-windows/bash
, but somehow managed to fumble the string into looking for /usr/usr/bin/bash.exe
, I'm not yet sure where the issue stems from just yet
Well, if your Z:\usr\bin\bash.exe
happens to be a copy of the Git wrapper by mistake, that would explain the funny command-line.
Considering that inside the arch container, /bin
is a symlink to /usr/bin
, that seems very possible. I will try to see what happens if I unsymlink the two and then install bash from git-for-windows.
Seems a lot of things in arch rely on /bin/<command>
existing, seems there's a lot of sedding in my future
seems like busybox is also taking over a few commands
[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: