[Bug 40013] MSYS2 based "Git for Windows" 2.7 fails to install due to

WineHQ Bugzilla wine-bugs at winehq.org
Sun Jan 19 10:37:49 CST 2020


https://bugs.winehq.org/show_bug.cgi?id=40013

Anastasius Focht <focht at gmx.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
          Component|-unknown                    |ntdll
                 CC|                            |focht at gmx.net
         Resolution|---                         |FIXED
      Fixed by SHA1|                            |a95d7f6c4fc17d5bb3b83ef6c7e
                   |                            |307b1ce06d554
            Summary|"Git for Windows" fails to  |MSYS2 based "Git for
                   |install                     |Windows" 2.7 fails to
                   |                            |install due to

--- Comment #9 from Anastasius Focht <focht at gmx.net> ---
Hello folks,

resolving 'fixed' here. The test procedure is kinda complicated because the
installer suffered from quite a number of overlapping issues.

Bug 39634 ("Git v2.6.3 (MSYS2 based): 'rebase.exe' fails on post-install steps
(commit page when handling stack fault)") has exactly the same backtrace.
It was supposed to be fixed by commit
https://source.winehq.org/git/wine.git/commit/7b66f9f6b475f95aaabdc4c2a2d44fa755ddac06
("ntdll: Commit new guard pages in virtual_handle_stack_fault.") in Wine 1.8+

--- snip ---
$ WINEDEBUG=+seh,+relay,+msi wine ./Git-2.7.0-32-bit.exe >>log.txt 2>&1
...
Can't recognize '`ed and `rebase.exe` does no such thing.' as an internal or
external command, or batch script.
...
0063:Call KERNEL32.CopyFileW(0030cd30 L"C:\\Program Files
(x86)\\Git\\usr\\bin\\rebase.exe",0030cf38 L"C:\\Program Files
(x86)\\Git\\bin\\rebase.exe",00000000) ret=7e955914 
...
0063:Call shell32.FindExecutableW(00311474 L"C:\\Program Files
(x86)\\Git\\bin\\\\rebase.exe",00000000,00311064) ret=7e963c23 
...
0063:Call KERNEL32.CreateFileW(00310b00 L"C:\\Program Files
(x86)\\Git\\bin\\rebase.exe",80000000,00000001,00000000,00000003,00000000,00000000)
ret=7e73b846
0063:Ret  KERNEL32.CreateFileW() retval=00000044 ret=7e73b846
...
0063:Call KERNEL32.CreateProcessW(00311474 L"C:\\Program Files
(x86)\\Git\\bin\\\\rebase.exe",00178b62 L"bin\\rebase.exe -b 0x64000000
usr\\bin\\msys-2.0.dll",00000000,00000000,00000001,00000000,00000000,00000000,00310fdc,00311020)
ret=7e963dc3 
...
0063:Ret  KERNEL32.CreateProcessW() retval=00000001 ret=7e963dc3 
...
0067:Call netapi32.NetLocalGroupGetInfo(00000000,006bc50a
L"Users",00000001,006bc308) ret=61125a94
fixme:netapi32:NetLocalGroupGetInfo ((null) L"Users" 1 0x6bc308) semi-stub!
0067:Call ntdll.RtlAllocateHeap(00110000,00000000,0000002a) ret=f7db63e5
0067:Ret  ntdll.RtlAllocateHeap() retval=00115ea8 ret=f7db63e5
0067:Ret  netapi32.NetLocalGroupGetInfo() retval=00000000 ret=61125a94
0067:Call netapi32.NetApiBufferFree(00115ea8) ret=61127083
0067:Call ntdll.RtlFreeHeap(00110000,00000000,00115ea8) ret=f7db6d4d
0067:Ret  ntdll.RtlFreeHeap() retval=00000001 ret=f7db6d4d
0067:Ret  netapi32.NetApiBufferFree() retval=00000000 ret=61127083
0067:Call ntdll.RtlIdentifierAuthoritySid(2001815c) ret=610e2209
0067:Ret  ntdll.RtlIdentifierAuthoritySid() retval=2001815e ret=610e2209
0067:Call KERNEL32.GetLastError() ret=610f505c
0067:Ret  KERNEL32.GetLastError() retval=00000534 ret=610f505c
0067:Call ntdll.RtlSubAuthorityCountSid(2001815c) ret=610e2266
0067:Ret  ntdll.RtlSubAuthorityCountSid() retval=2001815d ret=610e2266
0067:Call ntdll.RtlSubAuthoritySid(2001815c,00000000) ret=610e2241
0067:Ret  ntdll.RtlSubAuthoritySid() retval=20018164 ret=610e2241
0067:Call KERNEL32.GetLastError() ret=610f505c
0067:Ret  KERNEL32.GetLastError() retval=00000534 ret=610f505c
0067:Call ntdll.RtlSubAuthorityCountSid(2001815c) ret=610e2266
0067:Ret  ntdll.RtlSubAuthorityCountSid() retval=2001815d ret=610e2266
0067:Call ntdll.RtlSubAuthoritySid(2001815c,00000001) ret=610e2241
0067:Ret  ntdll.RtlSubAuthoritySid() retval=20018168 ret=610e2241
0067:Call KERNEL32.GetLastError() ret=610f505c
0067:Ret  KERNEL32.GetLastError() retval=00000534 ret=610f505c
0067:Call ntdll.RtlSubAuthorityCountSid(2001815c) ret=610e2266
0067:Ret  ntdll.RtlSubAuthorityCountSid() retval=2001815d ret=610e2266
0067:Call KERNEL32.GetLastError() ret=610f505c
0067:Ret  KERNEL32.GetLastError() retval=00000534 ret=610f505c
0067:Call ntdll.RtlInitUnicodeString(006bc228,006bc70c L"Users") ret=610f5345
0067:Ret  ntdll.RtlInitUnicodeString() retval=0000000c ret=610f5345
0067:Call ntdll.RtlInitializeSid(006bc8d8,006bc81a,00000002) ret=610e2312
0067:Ret  ntdll.RtlInitializeSid() retval=00000001 ret=610e2312
0067:Call ntdll.RtlCopySid(00000044,613023cc,006bc8d8) ret=61085bb1
0067:Ret  ntdll.RtlCopySid() retval=00000001 ret=61085bb1
trace:seh:raise_exception code=c0000005 flags=0 addr=0x611850e5 ip=611850e5
tid=0067
trace:seh:raise_exception  info[0]=00000000
trace:seh:raise_exception  info[1]=00000000
trace:seh:raise_exception  eax=00000000 ebx=00000000 ecx=00000002 edx=00002923
esi=006bc50a edi=006bc310
trace:seh:raise_exception  ebp=006bc968 esp=006bc264 cs=0023 ds=002b es=002b
fs=0063 gs=006b flags=00010202
trace:seh:call_stack_handlers calling handler at 0x61031eb0 code=c0000005
flags=0
...
--- snip ---

Extracted case:

--- snip ---
$ wine "C:\\Program Files (x86)\\Git\\bin\\rebase.exe" -b 0x64000000
"usr\\bin\\msys-2.0.dll"
--- snip ---

Starting with Wine 1.9.23 the crash of 'rebase.exe' was gone due to commit
https://source.winehq.org/git/wine.git/commitdiff/55be713d76bef86ba7577c810a9dbdfb071fc179
("cmd: When 'if' condition is not met, ignore the next commands in the list.")

That doesn't count as a proper fix for this installer because execution of
'rebase.exe' was now skipped due to different 'cmd.exe' behaviour. 

Content of 'post-install.bat':

---- snip ---
@REM This script is intended to be run after installation of Git for Windows
@REM (including the portable version)

@REM If run manually, it should be run via
@REM   git-bash.exe --no-needs-console --hide --no-cd
--command=post-install.cmd
@REM to hide the console.

@REM Change to the directory in which this script lives.
@REM https://technet.microsoft.com/en-us/library/bb490909.aspx says:
@REM <percent>~dpI Expands <percent>I to a drive letter and path only.
@REM <percent>~fI Expands <percent>I to a fully qualified path name.
@FOR /F "delims=" %%D IN ("%~dp0") DO @CD %%~fD

@REM If this is a 32-bit Git for Windows, adjust the DLL address ranges.
@REM We cannot use %PROCESSOR_ARCHITECTURE% for this test because it is
@REM allowed to install a 32-bit Git for Windows into a 64-bit system.
@IF EXIST mingw32\bin\git.exe @(
    @REM We need to rebase just to make sure that it still works even with
    @REM 32-bit Windows 10
    @FOR /F "tokens=4 delims=.[XP " %%i IN ('ver') DO @SET ver=%%i
    @IF 10 LEQ %ver @(
        @REM We copy `rebase.exe` because it links to `msys-2.0.dll`
        @REM (and @REM thus prevents modifying it). It is okay to
        @REM execute `rebase.exe`, though, because the DLL base address
        @REM problems only really show when other processes are
        @REM `fork()`ed and `rebase.exe` does no such thing.
        @IF NOT EXIST bin\rebase.exe @(
            @IF NOT EXIST bin @MKDIR bin
            @COPY usr\bin\rebase.exe bin\rebase.exe
        )
        @IF NOT EXIST bin\msys-2.0.dll @(
            @COPY usr\bin\msys-2.0.dll bin\msys-2.0.dll
        )
        @bin\rebase.exe -b 0x64000000 usr\bin\msys-2.0.dll
    )

    usr\bin\dash.exe -c '/usr/bin/dash usr/bin/rebaseall -p'
)

@REM Run the post-install scripts
@usr\bin\bash.exe --norc -c "export PATH=/usr/bin:$PATH; export
SYSCONFDIR=/etc; for p in $(export LC_COLLATE=C; echo
/etc/post-install/*.post); do test -e \"$p\" && . \"$p\"; done"

@REM Remove this script
@DEL post-install.bat 
---- snip ---

Minimized test case until cmd/batch file bugs became fixed:

--- snip ---
$ wine "C:\\Program Files (x86)\\Git\\usr\\bin\\rebase.exe" -b 0x64000000
"usr\\bin\\msys-2.0.dll"
--- snip ---

===

The delay in post-install step due to 'rebase.exe' hanging was fixed in between
Wine 4.1 and Wine 4.2, with commit:

https://source.winehq.org/git/wine.git/commitdiff/a95d7f6c4fc17d5bb3b83ef6c7e307b1ce06d554
("ntdll: Recreate the process parameters structure once everything has been
initialized.")

Before:

--- snip ---
$ WINEDEBUG=+seh,+relay,+ntdll,+server wine "C:\\Program Files
(x86)\\Git\\usr\\bin\\rebase.exe" -b 0x64000000 "usr\\bin\\msys-2.0.dll"
>>log.txt 2>&1
...
0009:Call
ntdll.NtOpenFile(006b9b14,00100001,006b9afc,006b9a98,00000007,00004020)
ret=6109503e
0009:trace:ntdll:FILE_CreateFile handle=0x6b9b14 access=00100001
name=L"\\??\\C:\\Program Files (x86)\\Git\\etc\\fstab.d\\n550+focht"
objattr=00000040 root=(nil) sec=(nil) io=0x6b9a98 alloc_size=(nil)
attr=00000000 sharing=00000007 disp=1 options=00004020 ea=(nil).0x00000000
0009:warn:ntdll:FILE_CreateFile L"\\??\\C:\\Program Files
(x86)\\Git\\etc\\fstab.d\\n550+focht" not found (c000003a)
0009:Ret  ntdll.NtOpenFile() retval=c000003a ret=6109503e
0009:Call ntdll.NtCreateEvent(006bc90c,001f0003,006bc918,00000001,00000000)
ret=61089bce
0009: create_event( access=001f0003, manual_reset=0, initial_state=0,
objattr={rootdir=0000,attributes=00000000,sd={},name=L""} )
0009: create_event() = 0 { handle=00c8 }
0009:Ret  ntdll.NtCreateEvent() retval=00000000 ret=61089bce
0009:Call ntdll.RtlInitUnicodeString(006bcb68,6121bd48 L"") ret=610b9862
0009:Ret  ntdll.RtlInitUnicodeString() retval=00000002 ret=610b9862
0009:Call
ntdll.NtOpenFile(006bcb64,00100020,006bcb78,006bcb70,00000007,00000021)
ret=610b98ca
0009:trace:ntdll:FILE_CreateFile handle=0x6bcb64 access=00100020 name=L""
objattr=00000042 root=0x10 sec=(nil) io=0x6bcb70 alloc_size=(nil) attr=00000000
sharing=00000007 disp=1 options=00000021 ea=(nil).0x00000000
0009: create_file( access=00100020, sharing=00000007, create=1,
options=00000021, attrs=00000000,
objattr={rootdir=0010,attributes=00000042,sd={},name=L""}, filename="." )
0009: create_file() = 0 { handle=00cc }
0009:Ret  ntdll.NtOpenFile() retval=00000000 ret=610b98ca
0009:Call ntdll.RtlCopyUnicodeString(61300a14,7bcffbc4) ret=610b99de
0009:Ret  ntdll.RtlCopyUnicodeString() retval=6130209c ret=610b99de
0009:Call KERNEL32.GetModuleHandleA(6121bb68 "ntdll.dll") ret=610b913c
0009:Ret  KERNEL32.GetModuleHandleA() retval=7bc10000 ret=610b913c
0009:Call KERNEL32.GetProcAddress(7bc10000,6121bb72 "RtlGetCurrentDirectory_U")
ret=610b915b
0009:Ret  KERNEL32.GetProcAddress() retval=7bc24ff0 ret=610b915b
0009:Call KERNEL32.GetProcAddress(7bc10000,6121bb8b "RtlEnterCriticalSection")
ret=610b9176
0009:Ret  KERNEL32.GetProcAddress() retval=7bc3c0e0 ret=610b9176
0009:trace:seh:raise_exception code=c0000005 flags=0 addr=0x610b91d0
ip=610b91d0 tid=0009
0009:trace:seh:raise_exception  info[0]=00000000
0009:trace:seh:raise_exception  info[1]=00000001
0009:trace:seh:raise_exception  eax=00000000 ebx=613009fc ecx=00000000
edx=00000000 esi=7bcffba0 edi=00000001
0009:trace:seh:raise_exception  ebp=7ffdf000 esp=006bcad0 cs=0023 ds=002b
es=002b fs=0063 gs=006b flags=00010257
0009:trace:seh:call_stack_handlers calling handler at 0x61031eb0 code=c0000005
flags=0
...
--- snip ---

After:

--- snip ---
$ WINEDEBUG=+seh,+relay,+ntdll,+server wine "C:\\Program Files
(x86)\\Git\\usr\\bin\\rebase.exe" -b 0x64000000 "usr\\bin\\msys-2.0.dll"
>>log.txt 2>&1
..
0009:Call ntdll.RtlInitUnicodeString(006b9aec,006bab60 L"\\??\\C:\\Program
Files (x86)\\Git\\etc\\fstab.d\\n550+focht") ret=610a0a49
0009:Ret  ntdll.RtlInitUnicodeString() retval=0000006c ret=610a0a49
0009:Call
ntdll.NtOpenFile(006b9b14,00100001,006b9afc,006b9a98,00000007,00004020)
ret=6109503e
0009:trace:ntdll:FILE_CreateFile handle=0x6b9b14 access=00100001
name=L"\\??\\C:\\Program Files (x86)\\Git\\etc\\fstab.d\\n550+focht"
objattr=00000040 root=(nil) sec=(nil) io=0x6b9a98 alloc_size=(nil)
attr=00000000 sharing=00000007 disp=1 options=00004020 ea=(nil).0x00000000
0009:warn:ntdll:FILE_CreateFile L"\\??\\C:\\Program Files
(x86)\\Git\\etc\\fstab.d\\n550+focht" not found (c000003a)
0009:Ret  ntdll.NtOpenFile() retval=c000003a ret=6109503e
0009:Call ntdll.NtCreateEvent(006bc90c,001f0003,006bc918,00000001,00000000)
ret=61089bce
0009: create_event( access=001f0003, manual_reset=0, initial_state=0,
objattr={rootdir=0000,attributes=00000000,sd={},name=L""} )
0009: create_event() = 0 { handle=00c8 }
0009:Ret  ntdll.NtCreateEvent() retval=00000000 ret=61089bce
0009:Call ntdll.RtlInitUnicodeString(006bcb68,6121bd48 L"") ret=610b9862
0009:Ret  ntdll.RtlInitUnicodeString() retval=00000002 ret=610b9862
0009:Call
ntdll.NtOpenFile(006bcb64,00100020,006bcb78,006bcb70,00000007,00000021)
ret=610b98ca
0009:trace:ntdll:FILE_CreateFile handle=0x6bcb64 access=00100020 name=L""
objattr=00000042 root=(nil) sec=(nil) io=0x6bcb70 alloc_size=(nil)
attr=00000000 sharing=00000007 disp=1 options=00000021 ea=(nil).0x00000000
0009:warn:ntdll:FILE_CreateFile L"" not found (c000003b)
0009:Ret  ntdll.NtOpenFile() retval=c000003b ret=610b98ca
0009:Call ntdll.RtlNtStatusToDosError(c000003b) ret=610306d5
0009:Ret  ntdll.RtlNtStatusToDosError() retval=000000a1 ret=610306d5
0009:Call
KERNEL32.DuplicateHandle(ffffffff,fffffffe,ffffffff,612c3ac8,00000000,00000000,00000002)
ret=61113225
0009: dup_handle( src_process=ffffffff, src_handle=fffffffe,
dst_process=ffffffff, access=00000000, attributes=00000000, options=00000002 )
0009: dup_handle() = 0 { handle=00cc, self=1, closed=0 }
0009:Ret  KERNEL32.DuplicateHandle() retval=00000001 ret=61113225 
...
--- snip ---

Likely some FAST_CWD related code paths.

===

The delay in bash post-install steps was fixed in between Wine 4.16 and Wine
4.17.

--- snip ---
 pid      threads  executable (all id:s are in hex)
...
 00000008 1        'Git-2.7.0-32-bit.exe'
 00000054 1        \_ 'Git-2.7.0-32-bit.tmp'
 00000062 1           \_ 'cmd.exe'
 0000006e 2              \_ 'bash.exe'
...
--- snip ---

--- snip ---
...
0063:trace:process:CreateProcessInternalW app L"C:\\Program Files
(x86)\\Git\\usr\\bin\\\\bash.exe" cmdline L"usr\\bin\\bash.exe --norc -c
\"export PATH=/usr/bin:$PATH; export SYSCONFDIR=/etc; for p in $(export
LC_COLLATE=C; echo /etc/post-install/*.post); do test -e \\\"$p\\\" && .
\\\"$p\\\"; done\""
...
0063:trace:process:CreateProcessInternalW starting L"C:\\Program Files
(x86)\\Git\\usr\\bin\\\\bash.exe" as Win32 binary (400000-613000, x86)
...
006f:trace:process:__wine_kernel_init starting process name=L"C:\\Program Files
(x86)\\Git\\usr\\bin\\bash.exe" argv[0]=L"usr\\bin\\bash.exe"
...
006f:fixme:ntdll:NtQueryVolumeInformationFile 0xe0: faking attribute info
..
006f:trace:seh:raise_exception code=c0000005 flags=0 addr=0x6115eef3
ip=6115eef3 tid=006f
006f:trace:seh:raise_exception  info[0]=00000000
006f:trace:seh:raise_exception  info[1]=00000000
006f:trace:seh:raise_exception  eax=613009fc ebx=20000008 ecx=00000014
edx=00000000 esi=00008000 edi=00000000
006f:trace:seh:raise_exception  ebp=0081b208 esp=0081b204 cs=0023 ds=002b
es=002b fs=0063 gs=006b flags=00010257
006f:trace:seh:call_stack_handlers calling handler at 0x61031eb0 code=c0000005
flags=0
...
<hang>
--- snip ---

Since the original bug report was about 'rebase.exe' crashing/hanging, using
https://source.winehq.org/git/wine.git/commitdiff/a95d7f6c4fc17d5bb3b83ef6c7e307b1ce06d554
("ntdll: Recreate the process parameters structure once everything has been
initialized.").

NOTE: The rebase tool still doesn't work under the hood but that's a different
problem.

$ sha1sum Git-2.7.0-32-bit.exe 
f5204f35c7fc43bff74481c4f3b14ff3c3be8c9e  Git-2.7.0-32-bit.exe

$ du -sh Git-2.7.0-32-bit.exe 
30M    Git-2.7.0-32-bit.exe

$ wine --version
wine-5.0-rc6

Regards

-- 
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.


More information about the wine-bugs mailing list