Skip to content
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

dotnet35sp1 application crashes - Winlink (RMS Express, versions <1.5.41.0) #217

Closed
WheezyE opened this issue Oct 5, 2020 · 106 comments
Closed

Comments

@WheezyE
Copy link
Contributor

WheezyE commented Oct 5, 2020

Seb, thank you again for all your hard work with this finicky program. The commits from today (commits near c7a4dbe I think?) are getting RMS Express to open (and connect to Telnet!) with mono - which is farther than ExaGear got using mono.

I did some analysis today using mono vs using dotnet35sp1+vcrun2015 (from my pre-loaded dotnet35sp1+vcrun2015 wineprefix from my Debian 10 x86 VMWare virtual computer on my Windows laptop copied to my Pi --- vcrun2015 and dotnet35sp1 still crash when trying to install in box86 on the Pi).

Total packages needed for RMS Express and VARA to work (as learned from a functioning/clunky wine+ExaGear install) are: winetricks -q corefonts dotnet35sp1 vb6run vcrun2015 sound=alsa win7 # VARA also needs an old WinNT4.0 pdh.dll

EDIT 8/1/2021: More testing has revealed that these are the only packages needed for each program ...
BOX86_NOBANNER=1 winetricks -q dotnet35sp1 win7 sound=alsa # for RMS Express (corefonts & vcrun2015 appear to be optional)
BOX86_NOBANNER=1 winetricks -q vb6run pdh_nt4 win7 sound=alsa # for VARA

Overview

With mono (not dotnet35sp1) installed, RMS Express opens(!) and the ARDOP and WINMOR modems open. But ARDOP and WINMOR don't function correctly (I learned from ExaGear that they need dotnet35sp1 to function correctly, VARA needs vcrun2015). With dotnet35sp1 installed (instead of mono), I get SIGSEGV's running RMS Express, ARDOP, WINMOR, and VARA. VARA installs, but doesn't run with mono nor with dotnet35sp1.

RMS Express

RMS Express w/ mono: Runs!!! No problems! Telnet works! modems don't work though

RMS Express w/ dotnet35sp1:
Using native(wrapped) libtinfo.so.6
0024:fixme:ntdll:NtQuerySystemInformation info_class SYSTEM_PERFORMANCE_INFORMATION
Using emulated /home/pi/wine/lib/wine/advapi32.dll.so
Using emulated /home/pi/wine/lib/wine/sechost.dll.so
Using emulated /home/pi/wine/lib/wine/ucrtbase.dll.so
Using emulated /home/pi/wine/lib/wine/api-ms-win-core-synch-l1-2-0.dll.so
Using emulated /home/pi/wine/lib/wine/api-ms-win-core-fibers-l1-1-1.dll.so
Using emulated /home/pi/wine/lib/wine/api-ms-win-core-localization-l1-2-1.dll.so
0024:fixme:ntdll:EtwEventRegister ({319dc449-ada5-50f7-428e-957db6791668}, 109BA1A0, 10A12460, 10A12478) stub.
0024:fixme:ntdll:EtwEventSetInformation (deadbeef, 2, 10993241, 28) stub
Using emulated /home/pi/wine/lib/wine/shlwapi.dll.so
Using emulated /home/pi/wine/lib/wine/shcore.dll.so
Using emulated /home/pi/wine/lib/wine/user32.dll.so
Using emulated /home/pi/wine/lib/wine/setupapi.dll.so
Using emulated /home/pi/wine/lib/wine/version.dll.so
Using emulated /home/pi/wine/lib/wine/rpcrt4.dll.so
Using emulated /home/pi/wine/lib/wine/gdi32.dll.so
Using emulated /home/pi/wine/lib/wine/ole32.dll.so
Using native(wrapped) libfreetype.so.6
Using native(wrapped) libfontconfig.so.1
Using emulated /home/pi/wine/lib/wine/imm32.dll.so
Using emulated /home/pi/wine/lib/wine/api-ms-win-appmodel-runtime-l1-1-2.dll.so
0024:fixme:ntdll:EtwEventRegister ({319dc449-ada5-50f7-428e-957db6791668}, 10C1B8F0, 11161058, 11161070) stub.
0024:fixme:ntdll:EtwEventSetInformation (deadbeef, 2, 10A309AD, 28) stub
Using emulated /home/pi/wine/lib/wine/api-ms-win-core-quirks-l1-1-0.dll.so
0024:fixme:kernelbase:QuirkIsEnabled3 (1020F4E0, FFFFFFFF) stub!
0024:fixme:heap:GetNumaHighestNodeNumber semi-stub: 1020FC14
0024:fixme:ntdll:EtwEventRegister ({e13c0d23-ccbc-4e12-931b-d9cc2eee27e4}, 10D54330, 11161100, 1116C108) stub.
0024:fixme:ntdll:EtwEventRegister ({763fd754-7086-4dfe-95eb-c01a46faf4ca}, 10D54330, 11162258, 111622C8) stub.
0024:fixme:ntdll:EtwEventRegister ({a669021c-c450-4609-a035-5af59af4df18}, 10D54330, 1116AC30, 1116C118) stub.
0024:fixme:ntdll:EtwEventRegister ({cc2bcbba-16b6-4cf3-8990-d74c2e8af500}, 10D54330, 11161220, 11161288) stub.
Using emulated /home/pi/wine/lib/wine/combase.dll.so
0024:fixme:seh:WerRegisterRuntimeExceptionModule (L"C:\\windows\\Microsoft.NET\\Framework\\v4.0.30319\\mscordacwks.dll", 10A20000) stub
23702|SIGSEGV @0x7cc5c264 (???) (x86pc=0x10bd0e63/???:"???"), for accessing 0x13640004 (code=2), db=0x59bf3f0(0x10bd0e63/???)
Warning, context has been changed in Sigactionhanlder (EIP changed)
23702|Double SIGSEGV!
Segmentation fault
pi@raspberrypi:~/.wine/drive_c/RMS Express $ 00a0:err:rpc:I_RpcReceive we got fault packet with status 0x1c010003
RMS Express w/ dotnet35sp1+vcrun2015:
00b8:fixme:ntdll:NtQuerySystemInformation info_class SYSTEM_PERFORMANCE_INFORMATION
00c4:fixme:process:SetProcessShutdownParameters (00000380, 00000000): partial stub.
Using emulated /home/pi/wine/lib/wine/kernel32.dll.so
Using emulated /home/pi/wine/lib/wine/kernelbase.dll.so
Using emulated /home/pi/wine/lib/wine/mscoree.dll.so
Using emulated /home/pi/wine/lib/wine/dbghelp.dll.so
Using emulated /home/pi/wine/lib/wine/ucrtbase.dll.so
Using emulated /home/pi/wine/lib/wine/shell32.dll.so
Using emulated /home/pi/wine/lib/wine/shlwapi.dll.so
Using emulated /home/pi/wine/lib/wine/shcore.dll.so
Using emulated /home/pi/wine/lib/wine/user32.dll.so
Using emulated /home/pi/wine/lib/wine/setupapi.dll.so
Using emulated /home/pi/wine/lib/wine/version.dll.so
Using emulated /home/pi/wine/lib/wine/advapi32.dll.so
Using emulated /home/pi/wine/lib/wine/sechost.dll.so
Using emulated /home/pi/wine/lib/wine/rpcrt4.dll.so
Using emulated /home/pi/wine/lib/wine/gdi32.dll.so
Using emulated /home/pi/wine/lib/wine/ole32.dll.so
Using native(wrapped) libncurses.so.6
Using native(wrapped) libtinfo.so.6
0024:fixme:ntdll:NtQuerySystemInformation info_class SYSTEM_PERFORMANCE_INFORMATION
Using native(wrapped) libfreetype.so.6
Using native(wrapped) libfontconfig.so.1
Using emulated /home/pi/wine/lib/wine/imm32.dll.so
Using emulated /home/pi/wine/lib/wine/mscorwks.dll.so
Using emulated /home/pi/wine/lib/wine/msvcr80.dll.so
0024:fixme:ntdll:EtwRegisterTraceGuidsW (7A03261A, 1090D0C0, {e13c0d23-ccbc-4e12-931b-d9cc2eee27e4}, 14, 7A3BEE40, (null), (null), 7A3BDC70): stub
0024:fixme:ntdll:EtwRegisterTraceGuidsW   register trace class {044973cd-251f-4dff-a3e9-9d6307286b05}
0024:fixme:ntdll:EtwRegisterTraceGuidsW   register trace class {3044f61a-99b0-4c21-b203-d39423c73b00}
0024:fixme:ntdll:EtwRegisterTraceGuidsW   register trace class {d00792da-07b7-40f5-97eb-5d974e054740}
0024:fixme:ntdll:EtwRegisterTraceGuidsW   register trace class {cfc4ba53-fb42-4757-8b70-5f5d51fee2f4}
0024:fixme:ntdll:EtwRegisterTraceGuidsW   register trace class {efdf1eac-1d5d-4e84-893a-19b80f692176}
0024:fixme:ntdll:EtwRegisterTraceGuidsW   register trace class {c71408de-42cc-4f81-9c93-b8912abf2a0f}
0024:fixme:ntdll:EtwRegisterTraceGuidsW   register trace class {840c8456-6457-4eb7-9cd0-d28f01c64f5e}
0024:fixme:ntdll:EtwRegisterTraceGuidsW   register trace class {c424b3e3-2ae0-416e-a039-410c5d8e5f14}
0024:fixme:ntdll:EtwRegisterTraceGuidsW   register trace class {300ce105-86d1-41f8-b9d2-83fcbff32d99}
0024:fixme:ntdll:EtwRegisterTraceGuidsW   register trace class {561410f5-a138-4ab3-945e-516483cddfbc}
0024:fixme:ntdll:EtwRegisterTraceGuidsW   register trace class {15447a14-b523-46ae-b75b-023f900b4393}
0024:fixme:ntdll:EtwRegisterTraceGuidsW   register trace class {b17304d9-5afa-4da6-9f7b-5a4fa73129b6}
0024:fixme:ntdll:EtwRegisterTraceGuidsW   register trace class {02d08a4f-fd01-4538-989b-03e437b950f4}
0024:fixme:ntdll:EtwRegisterTraceGuidsW   register trace class {861f5339-19d6-4873-b350-7b03228bda7c}
0024:fixme:ntdll:EtwRegisterTraceGuidsW (7A030638, 1090D0C0, {cc2bcbba-16b6-4cf3-8990-d74c2e8af500}, 1, 7A3BEE38, (null), (null), 7A3BDC78): stub
0024:fixme:ntdll:EtwRegisterTraceGuidsW   register trace class {ea40c74d-4f65-4561-bb26-656231c8967f}
23988|SIGSEGV @0x7c11bd58 (???) (x86pc=0x79f0a4f0/???:"???"), for accessing 0x12c30008 (code=2), db=0x4891230(0x79f0a4f0/???)
Warning, context has been changed in Sigactionhanlder (EIP changed)
23988|Double SIGSEGV!
Segmentation fault

VARA

VARA install (still needs vcrun2015):
DYNAREC=0 wine VARA\ setup\ \(Run\ as\ Administrator\).exe
BOX86_DYNAREC=0 BOX86_NOSIGSEGV=1 winetricks msxml3
BOX86_DYNAREC=0 winetricks -q vb6run
BOX86_DYNAREC=0 wine ~/.wine/drive_c/VARA/VARA\ Install.exe #seems(?) to install mswinsck.ocx with a sigsegv
#note: I think vcrun2015 is also a requirement for VARA but vcrun2015 doesn't install with box86 yet.
BOX86_DYNAREC=0 wine ~/.wine/drive_c/VARA/VARA.exe # crashes with or without DYNAREC enabled
VARA (with and without Dynarec) w/ mono (no vcrun2015):
Using emulated /home/pi/wine/lib/wine/sxs.dll.so
0024:fixme:olepicture:OleLoadPictureEx (10CB0DD4,7366,0,{7bf80980-bf32-101a-8bbb-00aa00300cab},x=0,y=0,f=0,1020FAB0), partially implemented.
Using emulated /home/pi/wine/lib/wine/usp10.dll.so
Using emulated /home/pi/wine/lib/wine/wsock32.dll.so
Using emulated /home/pi/wine/lib/wine/ws2_32.dll.so
Using emulated /home/pi/wine/lib/wine/iphlpapi.dll.so
Using native(wrapped) libresolv.so.2
23790|SIGSEGV @0xb5b4370c (???) (x86pc=0x7b630df0//home/pi/wine/lib/wine/kernel32.dll.so:"/home/pi/wine/lib/wine/ntdll.dll.so/wcslen"), for accessing (nil) (code=1), db=0x3d611e0(0x7bc88ce0//home/pi/wine/lib/wine/ntdll.dll.so/wcslen)
Warning, context has been changed in Sigactionhanlder (EIP changed)
23790|Double SIGSEGV!
Segmentation fault
VARA (with and without dynarec) w/ dotnet35sp1 (no vcrun2015):
Using emulated /home/pi/wine/lib/wine/sxs.dll.so
0024:fixme:olepicture:OleLoadPictureEx (10CB0DD4,7366,0,{7bf80980-bf32-101a-8bbb-00aa00300cab},x=0,y=0,f=0,1020FAB0), partially implemented.
Using emulated /home/pi/wine/lib/wine/usp10.dll.so
Using emulated /home/pi/wine/lib/wine/wsock32.dll.so
Using emulated /home/pi/wine/lib/wine/ws2_32.dll.so
Using emulated /home/pi/wine/lib/wine/iphlpapi.dll.so
Using native(wrapped) libresolv.so.2
23644|SIGSEGV @0x284fb74 (???) (x86pc=0xffffffff/???:"???"), for accessing (nil) (code=1), db=(nil)((nil)/???)
Warning, context has been changed in Sigactionhanlder (EIP changed)
23644|Double SIGSEGV!
Segmentation fault
VARA (with and without dynarec) w/ dotnet35sp1+vcrun2015:
Using emulated /home/pi/wine/lib/wine/sxs.dll.so
0024:fixme:olepicture:OleLoadPictureEx (10CB0DD4,7366,0,{7bf80980-bf32-101a-8bbb-00aa00300cab},x=0,y=0,f=0,1020FAB0), partially implemented.
Using emulated /home/pi/wine/lib/wine/usp10.dll.so
Using emulated /home/pi/wine/lib/wine/wsock32.dll.so
Using emulated /home/pi/wine/lib/wine/ws2_32.dll.so
Using emulated /home/pi/wine/lib/wine/iphlpapi.dll.so
Using native(wrapped) libresolv.so.2
24059|SIGSEGV @0xb5bad70c (???) (x86pc=0x7b630df0//home/pi/wine/lib/wine/kernel32.dll.so:"/home/pi/wine/lib/wine/ntdll.dll.so/wcslen"), for accessing (nil) (code=1), db=0x4af4218(0x7bc88ce0//home/pi/wine/lib/wine/ntdll.dll.so/wcslen)
Warning, context has been changed in Sigactionhanlder (EIP changed)
24059|Double SIGSEGV!
Segmentation fault
pi@raspberrypi:~/.wine/drive_c/VARA $ 009c:err:rpc:I_RpcReceive we got fault packet with status 0x1c010003
00c4:fixme:advapi:RegisterEventSourceW ((null),L".NET Runtime Optimization Service"): stub
00c4:fixme:advapi:DeregisterEventSource (0xcafe4242) stub
00b8:fixme:msvcrt:__clean_type_info_names_internal (0x64082a5c) stub

WINMOR (EDIT 8/1/2021: WINMOR has been discontinued)

WINMOR w/ mono: Runs! Doesn't function correctly:

wine WINMOR\ TNC.exe #w/ dotnet35sp1

0024:fixme:ntdll:EtwEventRegister ({319dc449-ada5-50f7-428e-957db6791668}, 10C1B8F0, 11161058, 11161070) stub.
0024:fixme:ntdll:EtwEventSetInformation (deadbeef, 2, 10A309AD, 28) stub
Using emulated /home/pi/wine/lib/wine/api-ms-win-core-quirks-l1-1-0.dll.so
0024:fixme:kernelbase:QuirkIsEnabled3 (1020F4E0, FFFFFFFF) stub!
0024:fixme:heap:GetNumaHighestNodeNumber semi-stub: 1020FC14
0024:fixme:ntdll:EtwEventRegister ({e13c0d23-ccbc-4e12-931b-d9cc2eee27e4}, 10D54330, 11161100, 1116C108) stub.
0024:fixme:ntdll:EtwEventRegister ({763fd754-7086-4dfe-95eb-c01a46faf4ca}, 10D54330, 11162258, 111622C8) stub.
0024:fixme:ntdll:EtwEventRegister ({a669021c-c450-4609-a035-5af59af4df18}, 10D54330, 1116AC30, 1116C118) stub.
0024:fixme:ntdll:EtwEventRegister ({cc2bcbba-16b6-4cf3-8990-d74c2e8af500}, 10D54330, 11161220, 11161288) stub.
Using emulated /home/pi/wine/lib/wine/combase.dll.so
0024:fixme:seh:WerRegisterRuntimeExceptionModule (L"C:\\windows\\Microsoft.NET\\Framework\\v4.0.30319\\mscordacwks.dll", 10A20000) stub
20973|SIGSEGV @0x7cc5d064 (???) (x86pc=0x10bd0e63/???:"???"), for accessing 0x13640004 (code=2), db=0x4a23428(0x10bd0e63/???)
Warning, context has been changed in Sigactionhanlder (EIP changed)
20973|Double SIGSEGV!
Segmentation fault
WINMOR w/ dotnet35sp1+vcrun2015 (WINMOR doesn't need vcrun2015 to function though):
00b8:fixme:ntdll:NtQuerySystemInformation info_class SYSTEM_PERFORMANCE_INFORMATION
00c4:fixme:process:SetProcessShutdownParameters (00000380, 00000000): partial stub.
Using emulated /home/pi/wine/lib/wine/kernel32.dll.so
Using emulated /home/pi/wine/lib/wine/kernelbase.dll.so
Using emulated /home/pi/wine/lib/wine/mscoree.dll.so
Using emulated /home/pi/wine/lib/wine/dbghelp.dll.so
Using emulated /home/pi/wine/lib/wine/ucrtbase.dll.so
Using emulated /home/pi/wine/lib/wine/shell32.dll.so
Using emulated /home/pi/wine/lib/wine/shlwapi.dll.so
Using emulated /home/pi/wine/lib/wine/shcore.dll.so
Using emulated /home/pi/wine/lib/wine/user32.dll.so
Using emulated /home/pi/wine/lib/wine/setupapi.dll.so
Using emulated /home/pi/wine/lib/wine/version.dll.so
Using emulated /home/pi/wine/lib/wine/advapi32.dll.so
Using emulated /home/pi/wine/lib/wine/sechost.dll.so
Using emulated /home/pi/wine/lib/wine/rpcrt4.dll.so
Using emulated /home/pi/wine/lib/wine/gdi32.dll.so
Using emulated /home/pi/wine/lib/wine/ole32.dll.so
Using native(wrapped) libncurses.so.6
Using native(wrapped) libtinfo.so.6
0024:fixme:ntdll:NtQuerySystemInformation info_class SYSTEM_PERFORMANCE_INFORMATION
Using native(wrapped) libfreetype.so.6
Using native(wrapped) libfontconfig.so.1
Using emulated /home/pi/wine/lib/wine/imm32.dll.so
Using emulated /home/pi/wine/lib/wine/mscorwks.dll.so
Using emulated /home/pi/wine/lib/wine/msvcr80.dll.so
0024:fixme:ntdll:EtwRegisterTraceGuidsW (7A03261A, 1090D070, {e13c0d23-ccbc-4e12-931b-d9cc2eee27e4}, 14, 7A3BEE40, (null), (null), 7A3BDC70): stub
0024:fixme:ntdll:EtwRegisterTraceGuidsW   register trace class {044973cd-251f-4dff-a3e9-9d6307286b05}
0024:fixme:ntdll:EtwRegisterTraceGuidsW   register trace class {3044f61a-99b0-4c21-b203-d39423c73b00}
0024:fixme:ntdll:EtwRegisterTraceGuidsW   register trace class {d00792da-07b7-40f5-97eb-5d974e054740}
0024:fixme:ntdll:EtwRegisterTraceGuidsW   register trace class {cfc4ba53-fb42-4757-8b70-5f5d51fee2f4}
0024:fixme:ntdll:EtwRegisterTraceGuidsW   register trace class {efdf1eac-1d5d-4e84-893a-19b80f692176}
0024:fixme:ntdll:EtwRegisterTraceGuidsW   register trace class {c71408de-42cc-4f81-9c93-b8912abf2a0f}
0024:fixme:ntdll:EtwRegisterTraceGuidsW   register trace class {840c8456-6457-4eb7-9cd0-d28f01c64f5e}
0024:fixme:ntdll:EtwRegisterTraceGuidsW   register trace class {c424b3e3-2ae0-416e-a039-410c5d8e5f14}
0024:fixme:ntdll:EtwRegisterTraceGuidsW   register trace class {300ce105-86d1-41f8-b9d2-83fcbff32d99}
0024:fixme:ntdll:EtwRegisterTraceGuidsW   register trace class {561410f5-a138-4ab3-945e-516483cddfbc}
0024:fixme:ntdll:EtwRegisterTraceGuidsW   register trace class {15447a14-b523-46ae-b75b-023f900b4393}
0024:fixme:ntdll:EtwRegisterTraceGuidsW   register trace class {b17304d9-5afa-4da6-9f7b-5a4fa73129b6}
0024:fixme:ntdll:EtwRegisterTraceGuidsW   register trace class {02d08a4f-fd01-4538-989b-03e437b950f4}
0024:fixme:ntdll:EtwRegisterTraceGuidsW   register trace class {861f5339-19d6-4873-b350-7b03228bda7c}
0024:fixme:ntdll:EtwRegisterTraceGuidsW (7A030638, 1090D070, {cc2bcbba-16b6-4cf3-8990-d74c2e8af500}, 1, 7A3BEE38, (null), (null), 7A3BDC78): stub
0024:fixme:ntdll:EtwRegisterTraceGuidsW   register trace class {ea40c74d-4f65-4561-bb26-656231c8967f}
24177|SIGSEGV @0x7c11e458 (???) (x86pc=0x79f0a4f0/???:"???"), for accessing 0x12c30008 (code=2), db=0x4f0d7b8(0x79f0a4f0/???)
Warning, context has been changed in Sigactionhanlder (EIP changed)
24177|Double SIGSEGV!
Segmentation fault
pi@raspberrypi:~/.wine/drive_c/RMS Express $ 00b8:fixme:msvcrt:__clean_type_info_names_internal (0x64082a5c) stub

ARDOP

ARDOP w/ mono: Runs! Doesn't function correctly:

wine ARDOP_Win.exe #w/ dotnet35sp1

0024:fixme:ntdll:NtQuerySystemInformation info_class SYSTEM_PERFORMANCE_INFORMATION
Using emulated /home/pi/wine/lib/wine/advapi32.dll.so
Using emulated /home/pi/wine/lib/wine/sechost.dll.so
Using emulated /home/pi/wine/lib/wine/ucrtbase.dll.so
Using emulated /home/pi/wine/lib/wine/api-ms-win-core-synch-l1-2-0.dll.so
Using emulated /home/pi/wine/lib/wine/api-ms-win-core-fibers-l1-1-1.dll.so
Using emulated /home/pi/wine/lib/wine/api-ms-win-core-localization-l1-2-1.dll.so
0024:fixme:ntdll:EtwEventRegister ({319dc449-ada5-50f7-428e-957db6791668}, 109BA1A0, 10A12460, 10A12478) stub.
0024:fixme:ntdll:EtwEventSetInformation (deadbeef, 2, 10993241, 28) stub
Using emulated /home/pi/wine/lib/wine/shlwapi.dll.so
Using emulated /home/pi/wine/lib/wine/shcore.dll.so
Using emulated /home/pi/wine/lib/wine/user32.dll.so
Using emulated /home/pi/wine/lib/wine/setupapi.dll.so
Using emulated /home/pi/wine/lib/wine/version.dll.so
Using emulated /home/pi/wine/lib/wine/rpcrt4.dll.so
Using emulated /home/pi/wine/lib/wine/gdi32.dll.so
Using emulated /home/pi/wine/lib/wine/ole32.dll.so
Using native(wrapped) libfreetype.so.6
Using native(wrapped) libfontconfig.so.1
Using emulated /home/pi/wine/lib/wine/imm32.dll.so
Using emulated /home/pi/wine/lib/wine/api-ms-win-appmodel-runtime-l1-1-2.dll.so
0024:fixme:ntdll:EtwEventRegister ({319dc449-ada5-50f7-428e-957db6791668}, 10C1B8F0, 11161058, 11161070) stub.
0024:fixme:ntdll:EtwEventSetInformation (deadbeef, 2, 10A309AD, 28) stub
Using emulated /home/pi/wine/lib/wine/api-ms-win-core-quirks-l1-1-0.dll.so
0024:fixme:kernelbase:QuirkIsEnabled3 (1020F4E0, FFFFFFFF) stub!
0024:fixme:heap:GetNumaHighestNodeNumber semi-stub: 1020FC14
0024:fixme:ntdll:EtwEventRegister ({e13c0d23-ccbc-4e12-931b-d9cc2eee27e4}, 10D54330, 11161100, 1116C108) stub.
0024:fixme:ntdll:EtwEventRegister ({763fd754-7086-4dfe-95eb-c01a46faf4ca}, 10D54330, 11162258, 111622C8) stub.
0024:fixme:ntdll:EtwEventRegister ({a669021c-c450-4609-a035-5af59af4df18}, 10D54330, 1116AC30, 1116C118) stub.
0024:fixme:ntdll:EtwEventRegister ({cc2bcbba-16b6-4cf3-8990-d74c2e8af500}, 10D54330, 11161220, 11161288) stub.
Using emulated /home/pi/wine/lib/wine/combase.dll.so
0024:fixme:seh:WerRegisterRuntimeExceptionModule (L"C:\\windows\\Microsoft.NET\\Framework\\v4.0.30319\\mscordacwks.dll", 10A20000) stub
21051|SIGSEGV @0x7cc59b64 (???) (x86pc=0x10bd0e63/???:"???"), for accessing 0x13640004 (code=2), db=0x51a7df0(0x10bd0e63/???)
Warning, context has been changed in Sigactionhanlder (EIP changed)
21051|Double SIGSEGV!
Segmentation fault
pi@raspberrypi:~/.wine/drive_c/RMS Express $ 009c:err:rpc:I_RpcReceive we got fault packet with status 0x1c010003
@WheezyE
Copy link
Contributor Author

WheezyE commented Oct 9, 2020

Just wanted to update this ticket and say thanks for the d0ac1e6 and 664dab7 commits you made to get us farther on this. We're getting close! It's awesome getting to work with you on the discord.

@WheezyE
Copy link
Contributor Author

WheezyE commented Oct 10, 2020

Found a bug in RMS Express after commit 549ff98 (that was done to help get VARA running). I just wanted to report it here to help debug. I don't think this was here before:

The "HF Channel Selector" in RMS Express crashes and doesn't leave a wine debugger log:

Running w/ box86 549ff98 using winetricks -q corefonts vb6run & mono (wine-devel=5.18, Pi 4).

Note: wine-devel=5.18 opens RMS Express with just mono on x86 Linux

The HF Channel Selector has to run before RMS Express will allow a user to select a channel and send a radio signal.
image

pi@raspberrypi:~/.wine/drive_c/RMS Express $ BOX86_DYNAREC=0 wine RMS\ Express.exe 
Box86 with Dynarec v0.1.3 549ff980 built on Oct 10 2020 06:52:04
Box86 with Dynarec v0.1.3 549ff980 built on Oct 10 2020 06:52:04
Box86 with Dynarec v0.1.3 549ff980 built on Oct 10 2020 06:52:04
0060:err:vulkan:wine_vk_init Failed to load libvulkan.so.1.
0060:err:ole:start_rpcss Failed to start RpcSs service
Box86 with Dynarec v0.1.3 549ff980 built on Oct 10 2020 06:52:04
0024:fixme:ntdll:NtQuerySystemInformation info_class SYSTEM_PERFORMANCE_INFORMATION
0024:err:module:dlopen_unix_dll module 0x6ed00000 already has a Unix module that's not "/home/pi/wine/lib/wine/user32.so"
0024:fixme:nls:GetFileMUIPath stub: 0x10, L"C:\\windows\\system32\\tzres.dll", (null), 1020E518, 10071298, 1020E51C, 1020E510
0024:fixme:nls:GetFileMUIPath stub: 0x10, L"C:\\windows\\system32\\tzres.dll", (null), 1020E518, 10071298, 1020E51C, 1020E510
0024:err:module:dlopen_unix_dll module 0x6ed00000 already has a Unix module that's not "/home/pi/wine/lib/wine/user32.so"
0024:fixme:uiautomation:UiaClientsAreListening ()
0024:fixme:uiautomation:UiaClientsAreListening ()
0024:fixme:uiautomation:UiaClientsAreListening ()
0024:fixme:ntdll:EtwEventRegister ({c651f5f6-1c0d-492e-8ae1-b4efd7c9d503}, 14751EE8, 00000000, 113CBAE0) stub.
0024:fixme:uiautomation:UiaClientsAreListening ()
0024:fixme:uiautomation:UiaClientsAreListening ()
0024:fixme:uiautomation:UiaClientsAreListening ()
0024:fixme:uiautomation:UiaClientsAreListening ()
0024:fixme:uiautomation:UiaClientsAreListening ()
0024:fixme:uiautomation:UiaClientsAreListening ()
0024:fixme:uiautomation:UiaClientsAreListening ()
0024:fixme:uiautomation:UiaClientsAreListening ()
0114:fixme:uiautomation:UiaReturnRawElementProvider (000100E8, 0, 0, 00000000) stub!
0114:fixme:uiautomation:UiaReturnRawElementProvider (000100EA, 0, 0, 00000000) stub!
0114:fixme:uiautomation:UiaReturnRawElementProvider (000100EC, 0, 0, 00000000) stub!
0114:fixme:uiautomation:UiaReturnRawElementProvider (000100EE, 0, 0, 00000000) stub!
0114:fixme:uiautomation:UiaReturnRawElementProvider (000100F0, 0, 0, 00000000) stub!
0024:fixme:uiautomation:UiaClientsAreListening ()
0024:fixme:uiautomation:UiaClientsAreListening ()
0024:fixme:uiautomation:UiaClientsAreListening ()
0024:fixme:uiautomation:UiaClientsAreListening ()
0024:fixme:uiautomation:UiaClientsAreListening ()
0024:fixme:uiautomation:UiaClientsAreListening ()
0024:fixme:uiautomation:UiaClientsAreListening ()
0024:fixme:uiautomation:UiaClientsAreListening ()
0024:fixme:uiautomation:UiaClientsAreListening ()
0024:fixme:uiautomation:UiaClientsAreListening ()
0024:fixme:uiautomation:UiaClientsAreListening ()
0024:fixme:uiautomation:UiaClientsAreListening ()
0024:fixme:uiautomation:UiaClientsAreListening ()
0024:fixme:uiautomation:UiaClientsAreListening ()
0024:fixme:uiautomation:UiaClientsAreListening ()
0024:fixme:thread:GetThreadUILanguage : stub, returning default language.
0024:fixme:nls:RtlGetThreadPreferredUILanguages 00000038, 1020B258, 00000000 1020B280
0024:fixme:nls:get_dummy_preferred_ui_language (0x38 1020B258 00000000 1020B280) returning a dummy value (current locale)
0024:fixme:nls:RtlGetThreadPreferredUILanguages 00000038, 1020B258, 1ABF3350 1020B280
0024:fixme:nls:get_dummy_preferred_ui_language (0x38 1020B258 1ABF3350 1020B280) returning a dummy value (current locale)

=================================================================
        Native Crash Reporting
=================================================================
Got a UNKNOWN while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================
wine: Unhandled exception 0x0eedfade in thread 24 at address 7B00F969 (thread 0024), starting debugger...

@WheezyE
Copy link
Contributor Author

WheezyE commented Oct 11, 2020

New opcode request for VARA after compiling Box86 2375d70

0308:fixme:olepicture:OleLoadPictureEx (10CB0E04,7366,0,{7bf80980-bf32-101a-8bbb-00aa00300cab},x=0,y=0,f=0,1020FB10), partially implemented.
9173|SIGSEGV @0xb5d88a04 (???) (x86pc=0x7bc5f880/???:"???"), for accessing (nil) (code=1), db=0x4967a28(0x7bc5f880/???)
9173|0x6640accc: Unimplemented Opcode 0F 01 4C 24 4A 0F B7 54

@WheezyE
Copy link
Contributor Author

WheezyE commented Nov 22, 2020

Not sure when this cropped up because I haven’t tried to run the Winlink installer in a while, but I just tried to run Winlink installer with Box86 eaf7d0a (box86 version w signal handling for dotnet30) and got these new errors:

errors:
pi@raspberrypi:~/Downloads/WinlinkExpressInstaller $ wine Winlink_Express_install.exe 
Box86 with Dynarec v0.1.5 eaf7d0a2 built on Nov 21 2020 04:33:05
Box86 with Dynarec v0.1.5 eaf7d0a2 built on Nov 21 2020 04:33:05
Box86 with Dynarec v0.1.5 eaf7d0a2 built on Nov 21 2020 04:33:05
002c:err:wineboot:main Cannot set the dir to L"C:\\windows" (2)
002c:err:wineboot:process_run_key Error running cmd L"C:\\windows\\system32\\winemenubuilder.exe -a -r" (2).
0034:fixme:service:scmdatabase_autostart_services Auto-start service L"MountMgr" failed to start: 2
0034:fixme:service:scmdatabase_autostart_services Auto-start service L"PlugPlay" failed to start: 2
0034:fixme:service:scmdatabase_autostart_services Auto-start service L"spupdsvc" failed to start: 2
0034:fixme:service:scmdatabase_autostart_services Auto-start service L"winebus" failed to start: 2
0034:fixme:service:scmdatabase_autostart_services Auto-start service L"wineusb" failed to start: 2
0034:fixme:service:scmdatabase_autostart_services Auto-start service L"clr_optimization_v2.0.50727_32" failed to start: 2
002c:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded.
002c:err:winediag:nodrv_CreateWindow The explorer process failed to start.
0048:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded.
0048:err:winediag:nodrv_CreateWindow The explorer process failed to start.
^C0024:err:seh:NtRaiseException Unhandled exception code c000013a flags 0 addr 0x6320c39f
Updating to Box86 e449a4e I get
pi@raspberrypi:~/Downloads/WinlinkExpressInstaller $ wine Winlink_Express_install.exe 
Box86 with Dynarec v0.1.5 e449a4e2 built on Nov 22 2020 04:51:02
Box86 with Dynarec v0.1.5 e449a4e2 built on Nov 22 2020 04:51:02
Box86 with Dynarec v0.1.5 e449a4e2 built on Nov 22 2020 04:51:02
002c:err:wineboot:main Cannot set the dir to L"C:\\windows" (2)
002c:err:wineboot:process_run_key Error running cmd L"C:\\windows\\system32\\winemenubuilder.exe -a -r" (2).
0034:fixme:service:scmdatabase_autostart_services Auto-start service L"MountMgr" failed to start: 2
0034:fixme:service:scmdatabase_autostart_services Auto-start service L"PlugPlay" failed to start: 2
0034:fixme:service:scmdatabase_autostart_services Auto-start service L"spupdsvc" failed to start: 2
0034:fixme:service:scmdatabase_autostart_services Auto-start service L"winebus" failed to start: 2
0034:fixme:service:scmdatabase_autostart_services Auto-start service L"wineusb" failed to start: 2
0034:fixme:service:scmdatabase_autostart_services Auto-start service L"clr_optimization_v2.0.50727_32" failed to start: 2
002c:err:shell:SHGetFolderPathAndSubDirW Failed to create directory L"C:\\users\\pi\\Application Data".
002c:err:shell:SHGetFolderPathAndSubDirW Failed to create directory L"C:\\users\\pi".
002c:err:shell:SHGetFolderPathAndSubDirW Failed to create directory L"C:\\users\\pi\\Local Settings\\Application Data".
0024:fixme:actctx:parse_depend_manifests Could not find dependent assembly L"Microsoft.Windows.Common-Controls" (6.0.0.0)
Box86 with Dynarec v0.1.5 e449a4e2 built on Nov 22 2020 04:51:02
0024:fixme:process:SetProcessDEPPolicy (1): stub
0024:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded.
0024:err:winediag:nodrv_CreateWindow The explorer process failed to start.
pi@raspberrypi:~/Downloads/WinlinkExpressInstaller $ 

This all be a bit moot anyway though until signal handling works for dotnet35sp1 since dotnet35sp1 is a pre-requisite for Winlink, but just wanted to post this error here for future debugging

@WheezyE
Copy link
Contributor Author

WheezyE commented Nov 29, 2020

Nice :) with 269bc9e (I believe), the Winlink installer runs again.

@WheezyE
Copy link
Contributor Author

WheezyE commented Dec 27, 2020

With dotnet35sp1 now installing in box86 (#227), I'm looking at Winlink again.

I'm getting some sigsegv's when trying to run it with just dotnet35sp1 installed. I've logged them with log1 here: log1.log

I also tried updating box86 with today's commits, then installing some of the other components that VARA needs (winetricks -q corefonts dotnet35sp1 vb6run vcrun2015 win7) and logged again here: morecomponents_log1.log

Log2 looks like this: morecomponents_log2.log.zip

@WheezyE
Copy link
Contributor Author

WheezyE commented Jan 1, 2021

Thanks for the updated signal handling for dotnet!

I’m getting these errors now when running RMS Express (dotnet35sp1) and WinRPR (dotnet40):

8044|SIGSEGV @0x4299dbdc (???(0x4299dbdc)) (x86pc=0x791f6d14/???:"???", esp=0x31ed68), for accessing 0x1413000 (code=2/prot=1), db=0x42a18938(0x4299d8cc:0x4299deb4/0x791f6c5d:0x791f6db5/???)
Error: Unsupported libc Syscall 0x13E (318)
Stop waiting for remaining thread 8094
Stop waiting for remaining thread 8095
8095|SIGSEGV @0x62868e78 (???(/usr/local/bin/box86/0x62868e78)) (x86pc=0x63f6d23a/???:"???", esp=0x357f0ac), for accessing 0x40b84f70 (code=1/prot=7), db=(nil)((nil):(nil)/(nil):(nil)/???)
8095|SIGSEGV @0x62868e78 (???(/usr/local/bin/box86/0x62868e78)) (x86pc=0x63f6d23a/???:"???", esp=0x357f0ac), for accessing 0x40b838d0 (code=1/prot=7), db=(nil)((nil):(nil)/(nil):(nil)/???)
8095|Double SIGSEGV!

RMSlog1.log

@WheezyE
Copy link
Contributor Author

WheezyE commented Jan 1, 2021

Getting even farther with eca39e6 !
With a fresh wineprefix, new dotnet35sp1 install, I run RMS Express and get Winlink Express dialogue box telling me an error happened in kernelbase32.dll. Here's the log1:
log1file.log

@WheezyE
Copy link
Contributor Author

WheezyE commented Jan 1, 2021

Log2 here: log2file (copy 1).log.zip :)

@WheezyE
Copy link
Contributor Author

WheezyE commented Jan 27, 2021

We're getting so close now that .net is functioning.

Winlink appears to error every OTHER time it opens (how odd), but not every time it opens.

I'm still suspicious of ngen. A winlink error dialog box pops up whenever ngen appears in the terminal (".NET Runtime version 2.0.50727.3053").

Screenshot:

image

With log1 I get:
Warning: Cannot dlopen("/home/pi/wine/lib/wine/iphlpapi.so"/0x4a560118, 2)
9202|SIGSEGV @0x43f4b288 (???(0x43f4b288)) (x86pc=0x79fc8582/???:"???", esp=0x851e78c), for accessing 0x8412754 (code=2/prot=7), db=0x679d5618(0x43f4b284:0x43f4b2c4/0x79fc857f:0x79fc8594/???:clean)
010c:fixme:advapi:RegisterEventSourceW ((null),L".NET Runtime"): stub
9138|SIGSEGV @0x6286b9b4 (???(/usr/local/bin/box86/0x6286b9b4)) (x86pc=0x8410851/???:"???", esp=0x31edd4), for accessing (nil) (code=1/prot=0), db=(nil)((nil):(nil)/(nil):(nil)/???:clean)
010c:fixme:advapi:ReportEventW (CAFE4242,0x0001,0x0000,0x000003ff,00000000,0x0001,0x00000000,0851DDC4,00000000): stub
010c:err:eventlog:ReportEventW L".NET Runtime version 2.0.50727.3053 - Fatal Execution Engine Error (7A097706) (80131506)"
010c:fixme:advapi:DeregisterEventSource (CAFE4242) stub

Trying to install (and override in winecfg) any version of a native iphlpapi.dll from online that I can find gives me a bunch of new errors.

I know ngen tries to do some kind of compiling thing on files so that they run faster the next time they're loaded. Maybe it's caching things (that are broken), crashing when it tries to load its cached files, then just rebuilding from scratch on the next run of the program.

I'm still working on figuring out the best installation conditions, but so far I have:
BOX86_NOBANNER=1 winetricks corefonts dotnet35sp1 vb6run win7 riched30 richtx32

I'm also currently experimenting with other winetricks packages (any related to dll warnings I've seen in the log1 output) to see if any help. So far, I'm trying winetricks comctl32 comctl32ocx comdlg32ocx usp10 gdiplus wininet winhttp secur32 vb6run vcrun2005 (as well as ole32 crypt32 msvcrt40 after renaming the downloaded windowsxp-kb936929...exe to the filename that winetricks is actually looking for - which is also pictured above in the lower terminal window), but I've been getting less stability this way so far.

@WheezyE
Copy link
Contributor Author

WheezyE commented Jan 27, 2021

wtf. It appears to not be erroring anymore. Sorry, this whole process is confusing.
After installing all those winetricks packages, I was switching them off/on (by commenting in/out the dll overrides) in ~/.wine/user.reg

Screenshot:

image

With this combo of overrides (ie with this combo of winetricks package installs) I'm not getting that crash anymore (and ngen isn't complaining).
[Software\\Wine\\DllOverrides] 1611783084
#time=1d6f4f3c3529214
"*atl80"="native,builtin"
"*comctl32"="native,builtin"
"*crypt32"="native"
#"*gdiplus"="native"
#"*iertutil"="native,builtin"
#"*msvcm80"="native,builtin"
#"*msvcp80"="native,builtin"
#"*msvcr80"="native,builtin"
#"*msvcrt40"="native,builtin"
#"*ole32"="native,builtin"
"*riched20"="native,builtin"
#"*secur32"="native,builtin"
#"*usp10"="native,builtin"
#"*vcomp"="native,builtin"
#"*winhttp"="native,builtin"
#"*wininet"="native,builtin"

So I guess just install whichever packages include the following dll files that I didn't comment out here with #

I'll try to figure out which packages those are exactly

@WheezyE
Copy link
Contributor Author

WheezyE commented Jan 27, 2021

(Sorry to spam - just kinda excited) I think I narrowed this ngen crash down to wine just missing winetricks crypt32. Maybe we just need to wrap crypt32.so?

EDIT: I found out that if I decide to install vb6run (so that winlink's internet works), then I needed to install these two things too winetricks comctl32ocx comdlg32ocx (maybe I just need one of them?)

I do still have all the other dll files in place in my wine system32 folder, so I'll try to see if it's truly just this dll or if Winlink/ngen need others too, but this is pretty exciting to think that ngen woes might just be from missing this crypt32.dll

(ps I'm running Box86 dd733c4, wine_5.21-devel, TwisterOS)


Another edit: I just tried some other combinations of things and wanted to post them here too.

Packages recommended by K6ETA:

winetricks -q corefonts win7 sound=alsa dotnet35sp1 vb6run # for winlink (I think vb6run is needed for internet)
winetricks -q vcrun2015 # vcrun2015 (vc 14.0) and pdh for VARA (but I can't get vcrun2015, vcrun2010, to install)

Tried:

(sideloaded prefix means a wineprefix where dotnet35sp1 was installed using wine on x86 Linux and the wineprefix was transferred to the RPi4)
sideloaded prefix + winlink (works but crashes every-other time it's loaded)
sideloaded prefix + crypt32 + winlink (WORKS! - initial error box but then no errors, no internet)
sideloaded prefix + crypt32 + vb6run + winlink (crashes)
sideloaded prefix + crypt32 + vb6run + comctl32ocx + comdlg32ocx + winlink (works and internet works - initial error box but then no errors)
sideloaded prefix + crypt32 + vb6run + comctl32ocx + comdlg32ocx + vcrun2008 + pdh (custom) + winlink (works - vara freezes?)
that last combo but with sound=alsa and sound card configured in VARA (works, VARA has graphical issues if run through Winlink but otherwise seems to function perfectly)

Try next:

dotnet35sp1 installer w/ crypt32 on older box86 builds which had crashes in the installer before
vcrun2015 as loaded from a previous version of box86 (there seems to have been a regression in vcrun2015 at some point)

@WheezyE
Copy link
Contributor Author

WheezyE commented Feb 12, 2021

With box86 9c5a9eb when I try to run RMS Express, the program seems to freeze now when trying to open. Log 1 shows this: Warning: Cannot dlopen("/home/pi/wine/lib/wine/shell32.so"/0x7db9d178, 2) at the freeze.

I’ll try to bisect and find the commit. Maybe this is related to the new crashes in ngen/dotnet?

@WheezyE
Copy link
Contributor Author

WheezyE commented Feb 12, 2021

That error appears to be a separate issue. I went back to the commit that has libcrypt wrapping and it appears that the wrapping isn’t playing nice with ngen. I’ll bisect that and log1 soon

@WheezyE
Copy link
Contributor Author

WheezyE commented Feb 12, 2021

I’m having some trouble today pinning down which commit causes RMS Express to not open anymore. Part of my problem is that I broke test.sh somehow (I think by experimenting with RAM stuff). The other half of my problem is that RMS Express still has that initial crash that pops up and I’m having trouble sorting out maybe two different crashes. I’ll probably focus on dotnet35sp1 installer first and come back to this issue after that’s resolved

@WheezyE
Copy link
Contributor Author

WheezyE commented Feb 22, 2021

Just wanted to say I’m excited to have put up a GitHub page to host an install script and hopefully make install easy for the hams I know:
https://github.com/WheezyE/Winelink

I’m so excited that VARA runs and am really looking forward to ironing out even more bugs and streamlining the dotnet install process. I’ve been trying to do this for two years and it wouldn’t have been possible to do it open-source without box86 and your help. Lots of work still to be done with Winlink on box86, but this is a pretty amazing proof of concept.

I’ll keep looking for bugs 🙂

@WheezyE
Copy link
Contributor Author

WheezyE commented Mar 14, 2021

These crashes took a while to track down since they happen inconsistently (and I got kind of busy this month + side-tracked working on my Winelink script)

RMS Express crashes happen whenever ngen crashes appear in the terminal (when running RMS Express): 0274:err:eventlog:ReportEventW L".NET Runtime version 2.0.50727.3053 - Fatal Execution Engine Error (7A097706) (80131506)"

The .NET ngen.exe that RMS Express relies on is located here: ~/.wine/drive_c/windows/Microsoft.NET/Framework/v2.0.50727/ngen.exe

After installing dotnet35sp1 (commit db5efa8 works to install dotnet35sp1), I believe we can test ngen alone by telling it to create a native image of any exe:

cd ~/.wine/drive_c/windows/Microsoft.NET/Framework/v2.0.50727 # must be in this directory to run ngen manually w wine?
wine ngen.exe vbc.exe

ngen stores the native images that it creates in ~/.wine/drive_c/windows/assembly/NativeImages_v2.0.50727_32


RMS Express testing notes (set up with my "Winelink" script, then removed native crypt32 from winecfg):
NOTE: RMS Express must be loaded about 4-5 times to get a successful launch.
NOTE: RMS Express crashes happen whenever ngen crashes happen `0274:err:eventlog:ReportEventW L".NET Runtime version 2.0.50727.3053 - Fatal Execution Engine Error (7A097706) (80131506)"`

test.sh ( commit )
Feb 3   (6a498c37) RMS Express works (w/ or w/o native crypt32, must load over and over for RMS Express to work on 1 out of 5 launches even if running wineserver -k)
Feb 8   (0ffc8682) RMS Express works (must load over and over for it to work just sometimes) (internet works)
xxxxx   (4837797f) RMS Express works (must load over and over for it to work just sometimes) (internet works)
				0178:fixme:crypt:CertAddCertificateLinkToStore (0x1cd618, 0x1d4d2c, 00000004, (nil)): semi-stub
				0174:fixme:path:parse_url failed to parse L"System.ServiceModel.Web"
				0174:fixme:path:parse_url failed to parse L"System.Runtime.Serialization"
				0174:fixme:path:parse_url failed to parse L"System.ServiceModel"
				0174:fixme:path:parse_url failed to parse L"SMDiagnostics"
				0194:fixme:path:parse_url failed to parse L"nsoftware.IPWorks"
				0144:fixme:path:parse_url failed to parse L"RMS Express.resources"
				0144:fixme:path:parse_url failed to parse L"RMS Express.resources"
				0144:fixme:virtual:NtFlushProcessWriteBuffers stub
				0144:fixme:gdiplus:GdipCreateHalftonePalette stub
				0194:fixme:path:parse_url failed to parse L"System.Web"
				0144:fixme:path:parse_url failed to parse L"nsoftware.IPWorks.System"
				01b0:fixme:bcrypt:BCryptGetFipsAlgorithmMode 0910EB9C - semi-stub
				01b0:fixme:bcrypt:BCryptGetFipsAlgorithmMode 0910E61C - semi-stub
				01a0:fixme:seh:NtQueryInformationThread ThreadIsIoPending info class not supported yet
xxxxx   (aeab3c81) RMS Express works (must load over and over for it to work just sometimes) (internet works) (try ctrl-c after a crash, then re-load. then no ngen errors should pop up in terminal on RMS express load)
xxxxx   (6409f5d4) RMS Express works (must load over and over for it to work just sometimes) (internet works) (try ctrl-c after a crash, then re-load. then no ngen errors should pop up in terminal on RMS express load)
xxxxx   (d3d431d5) RMS Express never opens (`ctrl-c` and `wineserver -k` tricks don't work here)
				0024:fixme:ntdll:EtwRegisterTraceGuidsW (7A030638, 00125610, {cc2bcbba-16b6-4cf3-8990-d74c2e8af500}, 1, 7A3BEE38, (null), (null), 7A3BDC78): stub
				0024:fixme:ntdll:EtwRegisterTraceGuidsW   register trace class {ea40c74d-4f65-4561-bb26-656231c8967f}
				# terminal is stuck here
Feb 9+  (xxxxxxxx) The above error persists for the rest of the box86 builds to current (be82ccb)

@ptitSeb
Copy link
Owner

ptitSeb commented Mar 15, 2021

Ok! So commit "d3d431d5" introduced some mutex mecanism, so I assume there is a deadlock happening here.
I tried to reproduce on my Pandora (can't try on my Pi for now) but I don't get any lock, so it maybe sensitive to timming.

If you can reproduce on your side (with latest box86 sources): once it's stuck, open another terminal, and with ps -A find the pid of "RMS Express.exe" (I assume the deadlock is in there), then attach a gdb to it using gdb -pid PID (with PID the pid number of the process).
In gdb use thread apply all bt to get the back trace in all thread: I need that output.
(you can then kill the app with k and quit gdb with q)

(in the mean time, I'll try to think of what could go wrong, but the backtrace would certainly help)

@WheezyE
Copy link
Contributor Author

WheezyE commented Mar 15, 2021

Awesome, alright here's the backtrace of RMS Express with box86 be82ccb. ngen wasn't in the PID list.

backtrace:
pi@raspberrypi:~/box86 $ ps -A
  PID TTY          TIME CMD
...
17795 pts/2    00:00:24 RMS Express.exe
...
pi@raspberrypi:~/box86 $ gdb -pid 17795
...
(gdb) thread apply all bt

Thread 2 (Thread 0x468aa2f0 (LWP 17842)):
#0  __libc_read (nbytes=16, buf=0x163f270, fd=14)
    at ../sysdeps/unix/sysv/linux/read.c:26
#1  __libc_read (fd=fd@entry=14, buf=buf@entry=0x163f270, 
    nbytes=nbytes@entry=16) at ../sysdeps/unix/sysv/linux/read.c:24
#2  0x628d72b4 in my_read (fd=14, buf=0x163f270, count=16)
    at /home/pi/Downloads/box86/src/wrapped/wrappedlibc.c:1586
#3  0x628b8ee4 in iFipu (emu=0x649be6b8, fcn=1653437076)
    at /home/pi/Downloads/box86/src/wrapped/generated/wrapper.c:2316
#4  0x628a4918 in x86Int3 (emu=0x649be6b8)
    at /home/pi/Downloads/box86/src/emu/x86int3.c:298
#5  0x41b190ac in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

Thread 1 (Thread 0x40064ff0 (LWP 17795)):
#0  my_box86signalhandler (sig=11, info=0xbed54a68, ucntx=0xbed54ae8)
    at /home/pi/Downloads/box86/src/libtools/signals.c:594
#1  <signal handler called>
#2  0x46c95f80 in ?? ()
#3  0x0000002a in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb) 

The terminal running RMS Express (frozen) reads:

...
0024:fixme:ntdll:EtwRegisterTraceGuidsW   register trace class {861f5339-19d6-4873-b350-7b03228bda7c}
0024:fixme:ntdll:EtwRegisterTraceGuidsW (7A030638, 001255C8, {cc2bcbba-16b6-4cf3-8990-d74c2e8af500}, 1, 7A3BEE38, (null), (null), 7A3BDC78): stub
0024:fixme:ntdll:EtwRegisterTraceGuidsW   register trace class {ea40c74d-4f65-4561-bb26-656231c8967f}
# stuck here

@WheezyE
Copy link
Contributor Author

WheezyE commented Mar 17, 2021

Thanks for the update!
Hm the freeze seems to still be happening at the same spot.


0024:fixme:ntdll:EtwRegisterTraceGuidsW   register trace class {861f5339-19d6-4873-b350-7b03228bda7c}
0024:fixme:ntdll:EtwRegisterTraceGuidsW (7A030638, 00125610, {cc2bcbba-16b6-4cf3-8990-d74c2e8af500}, 1, 7A3BEE38, (null), (null), 7A3BDC78): stub
0024:fixme:ntdll:EtwRegisterTraceGuidsW   register trace class {ea40c74d-4f65-4561-bb26-656231c8967f}

I never thought to try this till now, but I turned off dynarec and that got past the freeze in the latest commit (c254dc3) and in the Feb 9 (a062a8e) commit (though in both cases after turning off Dynarec, after Winlink loads it then has internet errors and always crashes w ngen problems - though these are probably separate issues).

@WheezyE
Copy link
Contributor Author

WheezyE commented Mar 18, 2021

Thank you again for your work on this error. The freeze is unfortunately still persisting.

Freeze happens here in the terminal
0024:fixme:ntdll:EtwRegisterTraceGuidsW (7A030638, 00125610, {cc2bcbba-16b6-4cf3-8990-d74c2e8af500}, 1, 7A3BEE38, (null), (null), 7A3BDC78): stub
0024:fixme:ntdll:EtwRegisterTraceGuidsW   register trace class {ea40c74d-4f65-4561-bb26-656231c8967f}
Log1
0024:fixme:ntdll:EtwRegisterTraceGuidsW (7A030638, 00125610, {cc2bcbba-16b6-4cf3-8990-d74c2e8af500}, 1, 7A3BEE38, (null), (null), 7A3BDC78): stub
0024:fixme:ntdll:EtwRegisterTraceGuidsW   register trace class {ea40c74d-4f65-4561-bb26-656231c8967f}
Using emulated /home/pi/wine/lib/wine/shell32.dll.so
Warning: Cannot dlopen("/home/pi/wine/lib/wine/shell32.so"/0x643ca730, 2)
Backtrace:
pi@raspberrypi:~/box86 $ gdb -pid 6190
GNU gdb (Raspbian 8.2.1-2) 8.2.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "arm-linux-gnueabihf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word".
Attaching to process 6190
[New LWP 6238]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".

Thread 1 "RMS Express.exe" received signal SIGSEGV, Segmentation fault.
0x46b961a8 in ?? ()
(gdb) thread apply all bt

Thread 2 (Thread 0x468c32f0 (LWP 6238)):
#0  __libc_read (nbytes=16, buf=0x165f270, fd=14)
    at ../sysdeps/unix/sysv/linux/read.c:26
#1  __libc_read (fd=fd@entry=14, buf=buf@entry=0x165f270, 
    nbytes=nbytes@entry=16) at ../sysdeps/unix/sysv/linux/read.c:24
#2  0x628d73bc in my_read (fd=14, buf=0x165f270, count=16)
    at /home/pi/box86/box86/src/wrapped/wrappedlibc.c:1586
#3  0x628b8fec in iFipu (emu=0x6369e6b8, fcn=1653437340)
    at /home/pi/box86/box86/src/wrapped/generated/wrapper.c:2316
#4  0x628a4a20 in x86Int3 (emu=0x6369e6b8)
    at /home/pi/box86/box86/src/emu/x86int3.c:298
#5  0x41b31774 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

Thread 1 (Thread 0x400ffff0 (LWP 6190)):
#0  0x46b961a8 in ?? ()
#1  0x0000002a in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb) 
With dynarec off the program opens:
0024:fixme:ntdll:EtwRegisterTraceGuidsW (7A030638, 00125610, {cc2bcbba-16b6-4cf3-8990-d74c2e8af500}, 1, 7A3BEE38, (null), (null), 7A3BDC78): stub
0024:fixme:ntdll:EtwRegisterTraceGuidsW   register trace class {ea40c74d-4f65-4561-bb26-656231c8967f}
00d8:err:ole:CoGetContextToken apartment not initialised
0024:fixme:path:parse_url failed to parse L"Microsoft.VisualBasic"
#keeps going

@ptitSeb
Copy link
Owner

ptitSeb commented Mar 18, 2021

well, it seem the deadlock doesn't happens on main "RMS Express.exe" program, as it is waiting for an answer from another program. Maybe wineserver, maybe another, I cann't tell, be if it was a deadlock, you would see some thread of the backtrace waiting on nanosleep or pthread_mutex_lock.

@WheezyE
Copy link
Contributor Author

WheezyE commented Mar 18, 2021

I will say, with dynarec off and with these patches, the other RMS Express crashes seem to be gone now and the internet works again

@ptitSeb
Copy link
Owner

ptitSeb commented Mar 18, 2021

At least something progress in the right direction! :)

@WheezyE
Copy link
Contributor Author

WheezyE commented Mar 21, 2021

I thought maybe I should post a log1 and backtrace of ngen too since .NET's ngen freezes in the same spot as RMS Express in the terminal (I believe RMS Express invokes ngen while opening).

Not sure if any of this helps, but here's Log1:
pi@raspberrypi:~/.wine/drive_c/windows/Microsoft.NET/Framework/v2.0.50727 $ BOX86_LOG=1 wine ngen.exe vbc.exe
Debug level is 1
Dynarec for ARM, with extension: HALF FAST_MULT EDSP NEON VFPv4 IDIVA PageSize:4096
Box86 with Dynarec v0.2.1 638b341b built on Mar 18 2021 07:49:49
BOX86: Wine detected, WINEPRELOADRESERVE=""
Using default BOX86_LD_LIBRARY_PATH: ./:lib/:lib32/:x86/
Using default BOX86_PATH: ./:bin/
Counted 46 Env var
Looking for /home/pi/wine/bin/wine
argv[1]="ngen.exe"
argv[2]="vbc.exe"
Using native(wrapped) libpthread.so.0
Using native(wrapped) libdl.so.2
Using native(wrapped) libc.so.6
Using native(wrapped) ld-linux.so.2
Using native(wrapped) librt.so.1
Using emulated /home/pi/wine/bin/../lib/wine/ntdll.so
Using native(wrapped) libm.so.6
Debug level is 1
Dynarec for ARM, with extension: HALF FAST_MULT EDSP NEON VFPv4 IDIVA PageSize:4096
Box86 with Dynarec v0.2.1 638b341b built on Mar 18 2021 07:49:49
BOX86: Wine detected, WINEPRELOADRESERVE=""
Using default BOX86_LD_LIBRARY_PATH: ./:lib/:lib32/:x86/
Using default BOX86_PATH: ./:bin/
Counted 47 Env var
Looking for /home/pi/wine/bin/wine
argv[1]="ngen.exe"
argv[2]="vbc.exe"
Using native(wrapped) libpthread.so.0
Using native(wrapped) libdl.so.2
Using native(wrapped) libc.so.6
Using native(wrapped) ld-linux.so.2
Using native(wrapped) librt.so.1
Using emulated /home/pi/wine/bin/../lib/wine/ntdll.so
Using native(wrapped) libm.so.6
Debug level is 1
Dynarec for ARM, with extension: HALF FAST_MULT EDSP NEON VFPv4 IDIVA PageSize:4096
Box86 with Dynarec v0.2.1 638b341b built on Mar 18 2021 07:49:49
Using default BOX86_LD_LIBRARY_PATH: ./:lib/:lib32/:x86/
Using default BOX86_PATH: ./:bin/
Counted 47 Env var
Looking for /home/pi/wine/bin/wineserver
Using native(wrapped) libdl.so.2
Using native(wrapped) libc.so.6
Using native(wrapped) ld-linux.so.2
Using native(wrapped) libpthread.so.0
Using native(wrapped) librt.so.1
Using emulated /home/pi/wine/lib/wine/../libwine.so.1
0050:err:ole:start_rpcss Failed to start RpcSs service
002c:fixme:ver:GetCurrentPackageId (0077FEA4 00000000): stub
Warning: Cannot dlopen("/home/pi/wine/lib/wine/kernel32.so"/0x642ab750, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/kernelbase.so"/0x642b8898, 2)
Using emulated /home/pi/wine/lib/wine/msvcrt.dll.so
Warning: Cannot dlopen("/home/pi/wine/lib/wine/msvcrt.so"/0x642edbe0, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/advapi32.so"/0x64309330, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/sechost.so"/0x64309330, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/api-ms-win-core-string-l1-1-0.so"/0x643018e0, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/api-ms-win-core-errorhandling-l1-1-0.so"/0x643029d8, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/api-ms-win-core-timezone-l1-1-0.so"/0x64302c28, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/api-ms-win-core-file-l1-1-0.so"/0x64302f48, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/api-ms-win-core-namedpipe-l1-1-0.so"/0x64303308, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/api-ms-win-core-handle-l1-1-0.so"/0x643034c8, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/api-ms-win-core-file-l2-1-0.so"/0x64303678, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/api-ms-win-core-heap-l1-1-0.so"/0x64303a58, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/api-ms-win-core-libraryloader-l1-1-0.so"/0x643040e8, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/api-ms-win-core-synch-l1-1-0.so"/0x64304190, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/api-ms-win-core-processthreads-l1-1-0.so"/0x643046c0, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/api-ms-win-core-processenvironment-l1-1-0.so"/0x64304a50, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/api-ms-win-core-datetime-l1-1-0.so"/0x64304da8, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/api-ms-win-core-localization-l1-2-0.so"/0x64305268, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/api-ms-win-core-sysinfo-l1-1-0.so"/0x64305510, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/api-ms-win-core-synch-l1-2-0.so"/0x64305628, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/api-ms-win-core-console-l1-1-0.so"/0x643059e0, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/api-ms-win-core-debug-l1-1-0.so"/0x64305d40, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/api-ms-win-core-processthreads-l1-1-1.so"/0x64306028, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/api-ms-win-core-file-l1-2-0.so"/0x64306310, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/api-ms-win-core-profile-l1-1-0.so"/0x643066c8, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/api-ms-win-core-memory-l1-1-0.so"/0x643067a8, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/api-ms-win-core-util-l1-1-0.so"/0x64306928, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/api-ms-win-core-rtlsupport-l1-1-0.so"/0x64306eb0, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/api-ms-win-core-interlocked-l1-1-0.so"/0x64307060, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/oleaut32.so"/0x64307478, 2)
Using emulated /home/pi/wine/lib/wine/gdi32.so
Warning: Cannot dlopen("/home/pi/wine/lib/wine/ole32.so"/0x6430f1b8, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/combase.so"/0x6430f580, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/rpcrt4.so"/0x6430fa58, 2)
Using emulated /home/pi/wine/lib/wine/user32.so
Warning: Cannot dlopen("/home/pi/wine/lib/wine/setupapi.so"/0x643105d8, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/version.so"/0x643105d8, 2)
Debug level is 1
Dynarec for ARM, with extension: HALF FAST_MULT EDSP NEON VFPv4 IDIVA PageSize:4096
Box86 with Dynarec v0.2.1 638b341b built on Mar 18 2021 07:49:49
BOX86: Wine detected, WINEPRELOADRESERVE="000400000-00048c000"
Using default BOX86_LD_LIBRARY_PATH: ./:lib/:lib32/:x86/
Using default BOX86_PATH: ./:bin/
Counted 49 Env var
Looking for /home/pi/wine/bin/wine
argv[1]="C:\windows\system32\conhost.exe"
argv[2]="--unix"
argv[3]="--width"
argv[4]="80"
argv[5]="--height"
argv[6]="24"
argv[7]="--server"
argv[8]="0x10"
Using native(wrapped) libpthread.so.0
Using native(wrapped) libdl.so.2
Using native(wrapped) libc.so.6
Using native(wrapped) ld-linux.so.2
Using native(wrapped) librt.so.1
Using emulated /home/pi/wine/bin/../lib/wine/ntdll.so
Using native(wrapped) libm.so.6
Using emulated /home/pi/wine/lib/wine/../libwine.so.1
Warning: Cannot dlopen("/home/pi/wine/lib/wine/kernel32.so"/0x64b0e3a8, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/kernelbase.so"/0x64b18ed0, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/conhost.so"/0x64b20b40, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/advapi32.so"/0x64b2bc18, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/sechost.so"/0x64b2bc18, 2)
0024:fixme:ntdll:NtQuerySystemInformation info_class SYSTEM_PERFORMANCE_INFORMATION
Warning: Cannot dlopen("/home/pi/wine/lib/wine/api-ms-win-core-string-l1-1-0.so"/0x64b2da68, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/api-ms-win-core-errorhandling-l1-1-0.so"/0x64b2ee80, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/api-ms-win-core-timezone-l1-1-0.so"/0x64b2f5d8, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/api-ms-win-core-file-l1-1-0.so"/0x64b2f6b8, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/api-ms-win-core-namedpipe-l1-1-0.so"/0x64b2fab0, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/api-ms-win-core-handle-l1-1-0.so"/0x64b2fe10, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/api-ms-win-core-file-l2-1-0.so"/0x64b2fd50, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/api-ms-win-core-heap-l1-1-0.so"/0x64b2ffa8, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/api-ms-win-core-libraryloader-l1-1-0.so"/0x64b30370, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/api-ms-win-core-synch-l1-1-0.so"/0x64b306d0, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/api-ms-win-core-processthreads-l1-1-0.so"/0x64b313b8, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/api-ms-win-core-processenvironment-l1-1-0.so"/0x64b31838, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/api-ms-win-core-datetime-l1-1-0.so"/0x64b31bb8, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/api-ms-win-core-localization-l1-2-0.so"/0x64b32070, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/api-ms-win-core-sysinfo-l1-1-0.so"/0x64b323d8, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/api-ms-win-core-synch-l1-2-0.so"/0x64b32560, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/api-ms-win-core-console-l1-1-0.so"/0x64b32918, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/api-ms-win-core-debug-l1-1-0.so"/0x64b32a78, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/api-ms-win-core-processthreads-l1-1-1.so"/0x64b32e40, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/api-ms-win-core-file-l1-2-0.so"/0x64b32e40, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/api-ms-win-core-profile-l1-1-0.so"/0x64b334f8, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/api-ms-win-core-fibers-l1-1-1.so"/0x643a5d20, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/api-ms-win-core-memory-l1-1-0.so"/0x64b33680, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/api-ms-win-core-util-l1-1-0.so"/0x64b33800, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/api-ms-win-core-rtlsupport-l1-1-0.so"/0x64b33900, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/api-ms-win-core-localization-l1-2-1.so"/0x643aef18, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/api-ms-win-core-interlocked-l1-1-0.so"/0x64b33f88, 2)
Using emulated /home/pi/wine/lib/wine/gdi32.so
Using emulated /home/pi/wine/lib/wine/user32.so
Warning: Cannot dlopen("/home/pi/wine/lib/wine/setupapi.so"/0x64b3c0e0, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/rpcrt4.so"/0x64b3c0e0, 2)
Using native(wrapped) libfreetype.so.6
Warning: Cannot dlopen("/home/pi/wine/lib/wine/version.so"/0x64b3c0e0, 2)
Using native(wrapped) libfontconfig.so.1
Warning: Cannot dlopen("/home/pi/wine/lib/wine/imm32.so"/0x6440f8f0, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/api-ms-win-core-fibers-l1-1-1.so"/0x64b753f8, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/api-ms-win-core-localization-l1-2-1.so"/0x64b82358, 2)
Using native(wrapped) libfreetype.so.6
Using native(wrapped) libfontconfig.so.1
Warning: Cannot dlopen("/home/pi/wine/lib/wine/imm32.so"/0x64be9b20, 2)
Microsoft (R) CLR Native Image Generator - Version 2.0.50727.3053
Copyright (c) Microsoft Corporation.  All rights reserved.
Warning: Cannot dlopen("/home/pi/wine/lib/wine/shlwapi.so"/0x6444c400, 2)
Warning: Cannot dlopen("/home/pi/wine/lib/wine/shcore.so"/0x6444c488, 2)
0024:fixme:service:QueryServiceConfig2W Level 6 not implemented
Installing assembly C:\windows\Microsoft.NET\Framework\v2.0.50727\vbc.exe
00e0:fixme:ntdll:NtQuerySystemInformation info_class SYSTEM_PERFORMANCE_INFORMATION
Warning: Cannot dlopen("/home/pi/wine/lib/wine/actxprxy.so"/0x6451ec40, 2)
00e0:fixme:ntdll:EtwRegisterTraceGuidsW (7A03261A, 0013CAA0, {e13c0d23-ccbc-4e12-931b-d9cc2eee27e4}, 14, 7A3BEE40, (null), (null), 7A3BDC70): stub
00e0:fixme:ntdll:EtwRegisterTraceGuidsW   register trace class {044973cd-251f-4dff-a3e9-9d6307286b05}
00e0:fixme:ntdll:EtwRegisterTraceGuidsW   register trace class {3044f61a-99b0-4c21-b203-d39423c73b00}
00e0:fixme:ntdll:EtwRegisterTraceGuidsW   register trace class {d00792da-07b7-40f5-97eb-5d974e054740}
00e0:fixme:ntdll:EtwRegisterTraceGuidsW   register trace class {cfc4ba53-fb42-4757-8b70-5f5d51fee2f4}
00e0:fixme:ntdll:EtwRegisterTraceGuidsW   register trace class {efdf1eac-1d5d-4e84-893a-19b80f692176}
00e0:fixme:ntdll:EtwRegisterTraceGuidsW   register trace class {c71408de-42cc-4f81-9c93-b8912abf2a0f}
00e0:fixme:ntdll:EtwRegisterTraceGuidsW   register trace class {840c8456-6457-4eb7-9cd0-d28f01c64f5e}
00e0:fixme:ntdll:EtwRegisterTraceGuidsW   register trace class {c424b3e3-2ae0-416e-a039-410c5d8e5f14}
00e0:fixme:ntdll:EtwRegisterTraceGuidsW   register trace class {300ce105-86d1-41f8-b9d2-83fcbff32d99}
00e0:fixme:ntdll:EtwRegisterTraceGuidsW   register trace class {561410f5-a138-4ab3-945e-516483cddfbc}
00e0:fixme:ntdll:EtwRegisterTraceGuidsW   register trace class {15447a14-b523-46ae-b75b-023f900b4393}
00e0:fixme:ntdll:EtwRegisterTraceGuidsW   register trace class {b17304d9-5afa-4da6-9f7b-5a4fa73129b6}
00e0:fixme:ntdll:EtwRegisterTraceGuidsW   register trace class {02d08a4f-fd01-4538-989b-03e437b950f4}
00e0:fixme:ntdll:EtwRegisterTraceGuidsW   register trace class {861f5339-19d6-4873-b350-7b03228bda7c}
00e0:fixme:ntdll:EtwRegisterTraceGuidsW (7A030638, 0013CAA0, {cc2bcbba-16b6-4cf3-8990-d74c2e8af500}, 1, 7A3BEE38, (null), (null), 7A3BDC78): stub
00e0:fixme:ntdll:EtwRegisterTraceGuidsW   register trace class {ea40c74d-4f65-4561-bb26-656231c8967f}
And backtrace:
pi@raspberrypi:~ $ gdb -pid 1001
GNU gdb (Raspbian 8.2.1-2) 8.2.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "arm-linux-gnueabihf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word".
Attaching to process 1001
[New LWP 1070]
[New LWP 1075]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
__libc_read (nbytes=16, buf=0x31d830, fd=7)
    at ../sysdeps/unix/sysv/linux/read.c:26
26	../sysdeps/unix/sysv/linux/read.c: No such file or directory.
(gdb) thread apply all bt

Thread 3 (Thread 0x46c122f0 (LWP 1075)):
#0  __libc_read (nbytes=16, buf=0x18ef2d0, fd=16)
    at ../sysdeps/unix/sysv/linux/read.c:26
#1  __libc_read (fd=fd@entry=16, buf=buf@entry=0x18ef2d0, 
    nbytes=nbytes@entry=16) at ../sysdeps/unix/sysv/linux/read.c:24
#2  0x628d73bc in my_read (fd=16, buf=0x18ef2d0, count=16)
    at /home/pi/box86/box86/src/wrapped/wrappedlibc.c:1586
#3  0x628b8fec in iFipu (emu=0x46a11368, fcn=1653437340)
    at /home/pi/box86/box86/src/wrapped/generated/wrapper.c:2316
#4  0x628a4a20 in x86Int3 (emu=0x46a11368)
    at /home/pi/box86/box86/src/emu/x86int3.c:298
#5  0x41c4cd24 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

Thread 2 (Thread 0x463ee2f0 (LWP 1070)):
#0  __libc_read (nbytes=16, buf=0x17cf060, fd=12)
    at ../sysdeps/unix/sysv/linux/read.c:26
#1  __libc_read (fd=fd@entry=12, buf=buf@entry=0x17cf060, 
    nbytes=nbytes@entry=16) at ../sysdeps/unix/sysv/linux/read.c:24
#2  0x628d73bc in my_read (fd=12, buf=0x17cf060, count=16)
    at /home/pi/box86/box86/src/wrapped/wrappedlibc.c:1586
#3  0x628b8fec in iFipu (emu=0x45ecb678, fcn=1653437340)
--Type <RET> for more, q to quit, c to continue without paging--
    at /home/pi/box86/box86/src/wrapped/generated/wrapper.c:2316
#4  0x628a4a20 in x86Int3 (emu=0x45ecb678)
    at /home/pi/box86/box86/src/emu/x86int3.c:298
#5  0x41c4cd24 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

Thread 1 (Thread 0x40116ff0 (LWP 1001)):
#0  __libc_read (nbytes=16, buf=0x31d830, fd=7)
    at ../sysdeps/unix/sysv/linux/read.c:26
#1  __libc_read (fd=fd@entry=7, buf=buf@entry=0x31d830, nbytes=nbytes@entry=16)
    at ../sysdeps/unix/sysv/linux/read.c:24
#2  0x628d73bc in my_read (fd=7, buf=0x31d830, count=16)
    at /home/pi/box86/box86/src/wrapped/wrappedlibc.c:1586
#3  0x628b8fec in iFipu (emu=0x6487d050, fcn=1653437340)
    at /home/pi/box86/box86/src/wrapped/generated/wrapper.c:2316
#4  0x628a4a20 in x86Int3 (emu=0x6487d050)
    at /home/pi/box86/box86/src/emu/x86int3.c:298
#5  0x41c4cd24 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb) k
Kill the program being debugged? (y or n) y
[Inferior 1 (process 1001) killed]
(gdb) q
pi@raspberrypi:~ $ 
ngen doesn’t freeze with dynarec off:
...
0154:fixme:ntdll:EtwRegisterTraceGuidsW (7A030638, 00136AB0, {cc2bcbba-16b6-4cf3-8990-d74c2e8af500}, 1, 7A3BEE38, (null), (null), 7A3BDC78): stub
0154:fixme:ntdll:EtwRegisterTraceGuidsW   register trace class {ea40c74d-4f65-4561-bb26-656231c8967f}
Error compiling C:\windows\Microsoft.NET\Framework\v2.0.50727\vbc.exe: Bad forma
t. (Exception from HRESULT: 0x8007000B)
0154:fixme:virtual:NtFlushProcessWriteBuffers stub
Uninstalling assembly C:\windows\Microsoft.NET\Framework\v2.0.50727\vbc.exe beca
use of an error during compilation.
0154:err:ole:CoReleaseMarshalData StdMarshal ReleaseMarshalData failed with error 0x8001011d
Bad format. (Exception from HRESULT: 0x8007000B)
pi@raspberrypi:~/.wine/drive_c/windows/Microsoft.NET/Framework/v2.0.50727 $

@WheezyE
Copy link
Contributor Author

WheezyE commented Mar 24, 2021

I gave gdb another shot today with the C freeze with box86 74d3bb7 and found a reference to "nanosleep" in winedevice.exe

I ran ngen again until freeze and then attached gdb to various processes and searched thread apply all bt. Then I copy-pasted the output into a text file and searched through there for "nanosleep", "pthread_mutex_lock", and "mutex".

Here's the backtrace of winedevice.exe (process 10979 in my instance):
pi@raspberrypi:~/box86 $ gdb -pid 10979
GNU gdb (Raspbian 8.2.1-2) 8.2.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "arm-linux-gnueabihf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word".
Attaching to process 10979
[New LWP 10981]
[New LWP 10982]
[New LWP 10983]
[New LWP 10986]
[New LWP 10987]
[New LWP 10988]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
__libc_read (nbytes=16, buf=0x72f050, fd=6)
    at ../sysdeps/unix/sysv/linux/read.c:26
26	../sysdeps/unix/sysv/linux/read.c: No such file or directory.
(gdb) thread apply all bt

Thread 7 (Thread 0x46bd52f0 (LWP 10988)):
#0  __GI___poll (timeout=60000, nfds=2, fds=0x46c02f70)
    at ../sysdeps/unix/sysv/linux/poll.c:29
#1  __GI___poll (fds=0x46c02f70, nfds=2, timeout=60000)
    at ../sysdeps/unix/sysv/linux/poll.c:26
Backtrace stopped: Cannot access memory at address 0x34

Thread 6 (Thread 0x469d12f0 (LWP 10987)):
#0  __GI___poll (timeout=-1, nfds=2, fds=0x469d0ccc)
    at ../sysdeps/unix/sysv/linux/poll.c:29
#1  __GI___poll (fds=0x469d0ccc, nfds=2, timeout=-1)
    at ../sysdeps/unix/sysv/linux/poll.c:26
#2  0x460b7a3c in ?? () from /lib/arm-linux-gnueabihf/libusb-1.0.so.0
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

Thread 5 (Thread 0x45edb2f0 (LWP 10986)):
#0  __GI___nanosleep (remaining=0x45edaa0c, requested_time=0x45edaa14)
    at ../sysdeps/unix/sysv/linux/nanosleep.c:28
#1  __GI___nanosleep (requested_time=0x45edaa14, remaining=0x45edaa0c)
    at ../sysdeps/unix/sysv/linux/nanosleep.c:25
#2  0x45252ad8 in ?? () from /lib/arm-linux-gnueabihf/libSDL2-2.0.so.0
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
--Type <RET> for more, q to quit, c to continue without paging--

Thread 4 (Thread 0x44fd62f0 (LWP 10983)):
#0  __libc_read (nbytes=16, buf=0x147f2c0, fd=19)
    at ../sysdeps/unix/sysv/linux/read.c:26
#1  __libc_read (fd=fd@entry=19, buf=buf@entry=0x147f2c0, 
    nbytes=nbytes@entry=16) at ../sysdeps/unix/sysv/linux/read.c:24
#2  0x628d6944 in my_read (fd=19, buf=0x147f2c0, count=16)
    at /home/pi/box86/box86/src/wrapped/wrappedlibc.c:1586
#3  0x628b8574 in iFipu (emu=0x444640a0, fcn=1653434660)
    at /home/pi/box86/box86/src/wrapped/generated/wrapper.c:2317
#4  0x628a4a20 in x86Int3 (emu=0x444640a0)
    at /home/pi/box86/box86/src/emu/x86int3.c:298
#5  0x43884bdc in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

Thread 3 (Thread 0x447032f0 (LWP 10982)):
#0  __libc_read (nbytes=16, buf=0x109f0a0, fd=15)
    at ../sysdeps/unix/sysv/linux/read.c:26
#1  __libc_read (fd=fd@entry=15, buf=buf@entry=0x109f0a0, 
    nbytes=nbytes@entry=16) at ../sysdeps/unix/sysv/linux/read.c:24
#2  0x628d6944 in my_read (fd=15, buf=0x109f0a0, count=16)
    at /home/pi/box86/box86/src/wrapped/wrappedlibc.c:1586
#3  0x628b8574 in iFipu (emu=0x44408998, fcn=1653434660)
--Type <RET> for more, q to quit, c to continue without paging--
    at /home/pi/box86/box86/src/wrapped/generated/wrapper.c:2317
#4  0x628a4a20 in x86Int3 (emu=0x44408998)
    at /home/pi/box86/box86/src/emu/x86int3.c:298
#5  0x43884bdc in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

Thread 2 (Thread 0x443482f0 (LWP 10981)):
#0  __libc_read (nbytes=16, buf=0xe8f270, fd=11)
    at ../sysdeps/unix/sysv/linux/read.c:26
#1  __libc_read (fd=fd@entry=11, buf=buf@entry=0xe8f270, 
    nbytes=nbytes@entry=16) at ../sysdeps/unix/sysv/linux/read.c:24
#2  0x628d6944 in my_read (fd=11, buf=0xe8f270, count=16)
    at /home/pi/box86/box86/src/wrapped/wrappedlibc.c:1586
#3  0x628b8574 in iFipu (emu=0x63d98b48, fcn=1653434660)
    at /home/pi/box86/box86/src/wrapped/generated/wrapper.c:2317
#4  0x628a4a20 in x86Int3 (emu=0x63d98b48)
    at /home/pi/box86/box86/src/emu/x86int3.c:298
#5  0x43884bdc in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

Thread 1 (Thread 0x40043ff0 (LWP 10979)):
#0  __libc_read (nbytes=16, buf=0x72f050, fd=6)
    at ../sysdeps/unix/sysv/linux/read.c:26
--Type <RET> for more, q to quit, c to continue without paging--
#1  __libc_read (fd=fd@entry=6, buf=buf@entry=0x72f050, 
    nbytes=nbytes@entry=16) at ../sysdeps/unix/sysv/linux/read.c:24
#2  0x628d6944 in my_read (fd=6, buf=0x72f050, count=16)
    at /home/pi/box86/box86/src/wrapped/wrappedlibc.c:1586
#3  0x628b8574 in iFipu (emu=0x63c3b050, fcn=1653434660)
    at /home/pi/box86/box86/src/wrapped/generated/wrapper.c:2317
#4  0x628a4a20 in x86Int3 (emu=0x63c3b050)
    at /home/pi/box86/box86/src/emu/x86int3.c:298
Backtrace stopped: Cannot access memory at address 0x16
(gdb) 
I also searched these other processes but didn't find references to "nanosleep", "pthread_mutex_lock", or "mutex".
  462 ?        00:00:07 winbindd
  559 ?        00:00:01 winbindd
  686 ?        00:00:00 pulseaudio
 8435 ?        00:00:00 cupsd
 8436 ?        00:00:00 cups-browsed
10948 pts/0    00:00:00 wine
10949 pts/0    00:00:01 ngen.exe
10951 ?        00:00:04 box86
10957 ?        00:00:00 services.exe
10960 ?        00:00:00 winedevice.exe
10962 pts/0    00:00:01 explorer.exe
10969 ?        00:00:00 plugplay.exe
10979 ?        00:00:02 winedevice.exe
10990 ?        00:00:00 svchost.exe
10996 pts/0    00:00:00 conhost.exe
10997 ?        00:00:00 kworker/3:1H
11000 pts/0    00:06:50 mscorsvw.exe
11004 ?        00:00:00 rpcss.exe
These were the other processes in my instance (I thought these might not have as much of a chance to find anything interesting):
    1 ?        00:00:09 systemd
    2 ?        00:00:00 kthreadd
    3 ?        00:00:00 rcu_gp
    4 ?        00:00:00 rcu_par_gp
    8 ?        00:00:00 mm_percpu_wq
    9 ?        00:00:01 ksoftirqd/0
   10 ?        00:00:32 rcu_sched
   11 ?        00:00:00 migration/0
   12 ?        00:00:00 cpuhp/0
   13 ?        00:00:00 cpuhp/1
   14 ?        00:00:00 migration/1
   15 ?        00:00:00 ksoftirqd/1
   18 ?        00:00:00 cpuhp/2
   19 ?        00:00:00 migration/2
   20 ?        00:00:05 ksoftirqd/2
   23 ?        00:00:00 cpuhp/3
   24 ?        00:00:00 migration/3
   25 ?        00:00:00 ksoftirqd/3
   28 ?        00:00:00 kdevtmpfs
   29 ?        00:00:00 netns
   32 ?        00:00:00 kauditd
   33 ?        00:00:00 khungtaskd
   34 ?        00:00:00 oom_reaper
   35 ?        00:00:00 writeback
   36 ?        00:00:00 kcompactd0
   54 ?        00:00:00 kblockd
   55 ?        00:00:00 blkcg_punt_bio
   56 ?        00:00:00 watchdogd
   57 ?        00:00:00 rpciod
   58 ?        00:00:00 kworker/u9:0-hci0
   59 ?        00:00:00 xprtiod
   60 ?        00:00:00 kswapd0
   61 ?        00:00:00 nfsiod
   62 ?        00:00:00 kthrotld
   63 ?        00:00:00 irq/55-aerdrv
   64 ?        00:00:00 iscsi_eh
   69 ?        00:00:00 DWC Notificatio
   70 ?        00:00:00 uas
   72 ?        00:00:00 vchiq-slot/0
   73 ?        00:00:00 vchiq-recy/0
   74 ?        00:00:00 vchiq-sync/0
   75 ?        00:00:00 vchiq-keep/0
   76 ?        00:00:00 SMIO
   78 ?        00:00:00 sdhci
   79 ?        00:00:00 irq/40-mmc0
   80 ?        00:00:00 mmc_complete
   82 ?        00:00:02 jbd2/mmcblk0p2-
   83 ?        00:00:00 ext4-rsv-conver
   84 ?        00:00:01 kworker/1:1H-kblockd
   86 ?        00:00:00 ipv6_addrconf
  103 ?        00:00:02 kworker/2:2H-kblockd
  104 ?        00:00:00 scsi_eh_0
  105 ?        00:00:00 scsi_tmf_0
  106 ?        00:00:14 usb-storage
  112 ?        00:00:01 kworker/3:2H-kblockd
  118 ?        00:00:03 systemd-journal
  122 ?        00:00:03 kworker/0:2H-kblockd
  154 ?        00:00:01 systemd-udevd
  195 ?        00:00:00 SMIO
  207 ?        00:00:00 mmal-vchiq
  210 ?        00:00:00 mmal-vchiq
  213 ?        00:00:00 mmal-vchiq
  215 ?        00:00:00 mmal-vchiq
  237 ?        00:00:03 v3d_bin
  240 ?        00:00:05 v3d_render
  242 ?        00:00:00 v3d_tfu
  243 ?        00:00:00 v3d_csd
  245 ?        00:00:00 v3d_cache_clean
  262 ?        00:00:00 cfg80211
  265 ?        00:00:00 brcmf_wq/mmc1:0
  266 ?        00:00:05 brcmf_wdog/mmc1
  329 ?        00:00:01 systemd-timesyn
  366 ?        00:01:42 avahi-daemon
  367 ?        00:00:01 udisksd
  369 ?        00:00:01 systemd-logind
  371 ?        00:00:00 dbus-daemon
  376 ?        00:00:00 avahi-daemon
  379 ?        00:00:00 cron
  381 ?        00:00:00 alsactl
  393 ?        00:00:00 rsyslogd
  402 ?        00:00:15 rngd
  412 ?        00:00:01 wpa_supplicant
  413 ?        00:00:03 thd
  445 ?        00:00:00 dhcpcd

  478 ?        00:00:00 polkitd
  490 ?        00:00:00 lightdm
  505 ?        00:00:00 sshd
  516 ?        00:01:59 wpa_supplicant
  544 tty7     00:02:07 Xorg
  546 tty1     00:00:00 login

  565 ?        00:00:00 lightdm
  570 ?        00:00:00 systemd
  571 ?        00:00:00 (sd-pam)
  581 ?        00:00:06 lxsession
  589 ?        00:00:00 dbus-daemon
  615 ?        00:00:01 ssh-agent
  626 ?        00:00:00 gvfsd
  631 ?        00:00:00 gvfsd-fuse
  645 ?        00:00:00 openbox
  647 ?        00:00:00 lxpolkit
  650 ?        00:08:22 lxpanel
  652 ?        00:00:02 pcmanfm
  658 ?        00:00:00 cmstart.sh
  661 ?        00:00:00 ssh-agent
  667 ?        00:00:00 xcompmgr
  681 ?        00:00:00 kworker/u9:1-hci0
  682 ?        00:00:00 hciattach
  685 ?        00:00:00 applet.py

  702 ?        00:00:05 rtkit-daemon
  724 tty1     00:00:00 bash
  728 ?        00:00:02 vncserverui
  749 ?        00:00:00 gvfs-udisks2-vo
  753 ?        00:00:00 vncserverui
  754 ?        00:00:00 gvfs-mtp-volume
  760 ?        00:00:00 gvfs-gphoto2-vo
  762 ?        00:00:00 menu-cached
  769 ?        00:00:00 gvfs-goa-volume
  773 ?        00:00:00 gvfs-afc-volume
  779 ?        00:00:00 gvfsd-trash
  791 ?        00:00:00 krfcommd
  802 ?        00:00:00 gvfsd-metadata
  937 ?        00:00:00 colord
  964 ?        00:00:12 lxterminal
  970 pts/0    00:00:00 bash
 1049 pts/1    00:00:00 bash

 8792 ?        00:00:00 kworker/3:1-events
 9262 ?        00:00:00 kworker/u8:1-cfg80211
 9265 ?        00:00:00 kworker/1:2-events_power_efficient
 9283 ?        00:00:00 kworker/2:1-events
10656 ?        00:00:00 kworker/2:0H-kblockd
10866 ?        00:00:00 kworker/0:0-events
10868 ?        00:00:00 kworker/1:2H
10947 ?        00:00:00 kworker/3:0-mm_percpu_wq

11033 ?        00:00:00 kworker/1:0-mm_percpu_wq
11034 ?        00:00:00 kworker/2:0-mm_percpu_wq
11051 ?        00:00:00 kworker/0:1+events
11052 ?        00:00:00 kworker/u8:0-events_unbound
11061 ?        00:00:00 kworker/0:1H
11077 pts/1    00:00:01 gdb
11081 ?        00:00:00 kworker/1:1-events
11082 ?        00:00:00 kworker/2:2-events_power_efficient
11083 ?        00:00:00 kworker/0:2-events
11084 ?        00:00:00 kworker/3:2-mm_percpu_wq
11085 ?        00:00:04 mousepad
11093 ?        00:00:00 dconf-service
11100 pts/2    00:00:00 bash
11105 pts/2    00:00:00 ps

@WheezyE
Copy link
Contributor Author

WheezyE commented Mar 26, 2021

With 00ac8ec , the freeze persists but nanosleep is gone from the backtrace of winedevice.exe. Nice work!
I’ll look for more nanosleeps or mutex errors today in a bit

@ptitSeb
Copy link
Owner

ptitSeb commented Oct 22, 2021

Are you sure you will not miss some of the needed define, like "ARM" or "DYNAREC_ARM" building that way?

@bbbruni
Copy link

bbbruni commented Oct 22, 2021

Hm, cmake seems to ignore those defines. I still don't understand why.

@WheezyE
Copy link
Contributor Author

WheezyE commented Oct 22, 2021

My bad, I misled you :(

@bbbruni: It's all good! I welcome all your ideas and appreciate you trying. It was a good thought.
@ptitSeb & bbbruni: I downloaded a fresh git repo, cherry-picked up to the 4e54731 equivalent patch again, and tried Seb's compiling instructions, but still get the same SIGBUS loop on that older commit. Not sure if that helps, but I appreciate the attempt.

Here's the SIGBUS loop:

...
0483|SIGBUS @0x62975c5c (???(/usr/local/bin/box86/0x62975c5c)) (x86pc=0x7d001570//home/pi/wine/bin/wine:"???", esp=0x413503ac), for accessing 0x62cdd91d (code=1/prot=0), db=(nil)((nil):(nil)/(nil):(nil)/???:clean) x86opcode=55 57 56 53 E8 57 FE FF
0483|SIGBUS @0x62975c68 (???(/usr/local/bin/box86/0x62975c68)) (x86pc=0x7d001570//home/pi/wine/bin/wine:"???", esp=0x413503ac), for accessing 0x62cdd91d (code=1/prot=0), db=(nil)((nil):(nil)/(nil):(nil)/???:clean) x86opcode=55 57 56 53 E8 57 FE FF
0483|SIGBUS @0x62975c5c (???(/usr/local/bin/box86/0x62975c5c)) (x86pc=0x7d001570//home/pi/wine/bin/wine:"???", esp=0x413503ac), for accessing 0x62cdd91d (code=1/prot=0), db=(nil)((nil):(nil)/(nil):(nil)/???:clean) x86opcode=55 57 56 53 E8 57 FE FF
0483|SIGBUS @0x62975c68 (???(/usr/local/bin/box86/0x62975c68)) (x86pc=0x7d001570//home/pi/wine/bin/wine:"???", esp=0x413503ac), for accessing 0x62cdd91d (code=1/prot=0), db=(nil)((nil):(nil)/(nil):(nil)/???:clean) x86opcode=55 57 56 53 E8 57 FE FF
0483|SIGBUS @0x62975c5c (???(/usr/local/bin/box86/0x62975c5c)) (x86pc=0x7d001570//home/pi/wine/bin/wine:"???", ^C
pi@raspberrypi:~/.wine/drive_c/RMS Express $ 

@ptitSeb
Copy link
Owner

ptitSeb commented Oct 22, 2021

Ok, so SIGBUS means "unaligned access" (roughly).

What I see is the x64opcodes are 55 57 56 53, so basicaly some "PUSH" opcode. The error is on accessing 0x62cdd91d wich is not a multiple of 4 address (but a multiple of 2).
I remember that PUSH/POP opcodes in the dynarec was having an issue on unaligned stack pointer in the past, but I fixed that (by changing the emited ARM codes).
I'm surprised to see this kind of error again.
Is the loop the same with current box86 code?

@WheezyE
Copy link
Contributor Author

WheezyE commented Oct 22, 2021 via email

@WheezyE
Copy link
Contributor Author

WheezyE commented Nov 7, 2021

I think I’m going to close this issue since it’s really a dotnet35sp1 and dotnet <4.8 issue. RMS Express and it’s modems seems to work ok in Box86 with wine-mono. There are some wine-mono bugs, but madewokherd and I are slowly working through those.

RMS Express was also updated recently to require dotnet46 now instead of dotnet35sp1. So the premise of the issue has changed slightly as well (though dotnet46 is still reliant on older dotnets like 35 I think).

I may open a generic =<dotnet46 thread with more updated info later

@WheezyE WheezyE closed this as completed Nov 7, 2021
@WheezyE
Copy link
Contributor Author

WheezyE commented Nov 7, 2021

Thank you again for all your hard work on this! I really sincerely appreciate all the time you’ve spent on this. I haven’t given up on it either, just migrating to a newer and more specific thread

@bbbruni
Copy link

bbbruni commented Nov 19, 2021

Thank you again for all your hard work on this! I really sincerely appreciate all the time you’ve spent on this. I haven’t given up on it either, just migrating to a newer and more specific thread

Sebastien seems to have fixed the analogous issue with RimWorld: ptitSeb/box64#110 (comment)

Could you re-test RMS express with native .NET (not mono) with new two key switches with the latest box86?
$ BOX86_DYNAREC_BIGBLOCK=0 BOX86_DYNAREC_STRONGMEM=1 wine ~/.wine/drive_c/RMS\ Express/RMS\ Express.exe
Edit:
Corrected a typo thanks to Sebastien

@ptitSeb
Copy link
Owner

ptitSeb commented Nov 19, 2021

Just to note: BOX86_DYNAREC_BIGBLOCK=1 is the default value. Use BOX86_DYNAREC_BIGBLOCK=0 to disable the BigBlock in Dynarec for C#/Mono stuff...
Also, you can try BOX86_DYNAREC_STRONGMEM=2...

@WheezyE
Copy link
Contributor Author

WheezyE commented Nov 20, 2021

😲 It works!!!!! Amazing job guys!!

.NET 4.0, 4.5, & 4.6 (pre-req for the newest version of RMS Express) successfully install with BOX86_NOBANNER=1 BOX86_DYNAREC_BIGBLOCK=0 BOX86_DYNAREC_STRONGMEM=2 winetricks dotnet46.

RMS Express & VARA run with BOX86_DYNAREC_BIGBLOCK=0 BOX86_DYNAREC_STRONGMEM=2 wine RMS\ Express.exe!

ARDOP seems to not want to run for some reason, but that's a lesser issue. I'll see if installing .NET 3.5 sp1 might fix that.

@WheezyE
Copy link
Contributor Author

WheezyE commented Nov 20, 2021

.NET 3.5sp1 installs too. ARDOP weirdly doesn't want to run though - I've attached a log2.
ardop_box86.log.zip

EDIT: Here's a log1 too ardop_box86log1.log

ARDOP is a small program that's packaged in with RMS Express (Winlink Express). You can get it by installing Winlink Express, or download it standalone if you join the ARDOP developers google group: https://ardop.groups.io/g/developers/files/ARDOP_Win.exe

@WheezyE WheezyE reopened this Nov 20, 2021
@ptitSeb
Copy link
Owner

ptitSeb commented Nov 20, 2021

I'll check ARDOP later.

Is StrongMem "2" mode mendatory, or does it work with "1"? You should note that the performance penalty for StrongMem 2 is significant, so it should be used only when necessary (like CPU emulation can be 50% slower, that's what I measured on 7z benchmark on 64bits, need to try on 32bits)

@WheezyE
Copy link
Contributor Author

WheezyE commented Nov 20, 2021

Just some preliminary testing: RMS Express seems to run ok with StrongMem off (and strongmem 1 or 2). Turning bigblock on seems to cause a crash every other time i load/run the RMS Express.exe though

@bbbruni
Copy link

bbbruni commented Nov 20, 2021

Just some preliminary testing: RMS Express seems to run ok with StrongMem off (and strongmem 1 or 2). Turning bigblock on seems to cause a crash every other time i load/run the RMS Express.exe though

So it looks like RMS Express was fixed either by bff458d or by d116855.

d116855 was merged earlier.

Could you please help with finding out what commit gave the fix?

checkout to d116855 and run $ BOX86_DYNAREC_BIGBLOCK=0 wine ~/.wine/drive_c/RMS\ Express/RMS\ Express.exe

If it still crashes, checkout to bff458d and run the same command

@WheezyE
Copy link
Contributor Author

WheezyE commented Nov 21, 2021

I tested each of these commits by loading RMS Express four times and found these significant commits (bolded):
11/19/21 bff458d BOX86_DYNAREC_BIGBLOCK=0 wine RMS\ Express.exe runs great
11/19/21 bff458d BOX86_DYNAREC_BIGBLOCK=1 wine RMS\ Express.exe runs but some loads freeze
11/18/21 d116855 BOX86_DYNAREC_BIGBLOCK=0 wine RMS\ Express.exe runs great
11/18/21 d116855 BOX86_DYNAREC_BIGBLOCK=1 wine RMS\ Express.exe runs but some loads freeze
11/18/21 5dd4a31 wine RMS\ Express.exe runs but some loads freeze
11/14/21 283eeca wine RMS\ Express.exe runs but some loads freeze
11/14/21 8373bee wine RMS\ Express.exe runs but some loads freeze
11/09/21 a474c66 wine RMS\ Express.exe always freezes during load
11/01/21 428d59a wine RMS\ Express.exe always freezes during load


System specs: RPi4 2GB, Twister OS buster, wine-devel 6.19, fresh wineprefix w/ dotnet46 & dotnet35sp1 (installed using box86 5368285).

pale's test.sh helped a lot to bisect commits.

I made this build_from_commit.sh script too
#!/bin/bash

sudo apt-get install cmake -y
cd ~/box86
rm -rf box86
git clone https://github.com/ptitSeb/box86
cd box86/
git checkout 8373bee595c94e339bf6ed81748cd6ead9e88496
mkdir build; cd build; cmake .. -DRPI4=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo
make -j3
sudo make install # copies box86 files to /usr/local/bin/box86
sudo systemctl restart systemd-binfmt # essentially initializes box86
git checkout master

@WheezyE
Copy link
Contributor Author

WheezyE commented Nov 21, 2021

Just did a little more testing and found more interesting info: dotnet35sp1 still appears broken in the latest box86 even though dotnet46 works great. Since all versions of RMS Express after/including v1.5.41.0 now use dotnet46 (versions before that used dotnet35sp1), this doesn't affect me. But I wanted to report in on it for bughunting.

Old RMS Express, new box86:
I installed dotnet35sp1 with an older version of my winelink script (which uses older box86 versions that I know work to install dotnet35sp1). The script installed the latest RMS Express (>v1.5.41.0, which uses dotnet46) but I then uninstalled that and downgraded to an older version of RMS Express (v1.5.39.0, which uses dotnet35sp1). I ran RMS Express with box86 built Jan 30, 2021 (807519e) and everything ran (albiet with errors and freezes). Then after upgrading to box86 e255bc0, RMS Express v1.5.39.0 wouldn't run no matter what bigblock or strongmem settings I used.

I'm attaching the old version of RMS Express v1.5.39.0 that uses dotnet35sp1, since I don't think you can find it on the internet.
Winlink_Express_install_1-5-39-0.zip

I'm also attaching some logs of the dotnet35sp1 crash (loading the old RMS Express) with newer box86 e255bc0 (BOX86_LOG=2 BOX86_DYNAREC_BIGBLOCK=0 BOX86_DYNAREC_STRONGMEM=2 wine RMS\ Express.exe 2>&1 | tee oldrms_dn35sp1_newbox86_bigblockoff.log2)
oldrms_dn35sp1_newbox86_bigblockoff.zip

@bbbruni
Copy link

bbbruni commented Nov 22, 2021

Thank you for your tests!

I ran RMS Express with box86 built Jan 30, 2021 (807519e) and everything ran (albiet with errors and freezes). Then after upgrading to box86 e255bc0, RMS Express v1.5.39.0 wouldn't run no matter what bigblock or strongmem settings I used.

You were using box86 with dynarec on, right? I wrote the following text out of supposition you had launched RMS Express on [807519e] with dynarec on.

Looking through box86 changes made by d3d431d, I've found something

This commit removed a significant part of updateProtection function in custommem.c, which would restore later. But this part has not been restored.

Could you check out to box86 built Jan 30, 2021 (807519e) and comment out lines 570-577 (including the latter) and line 582 in custommem.c?
I.e.

void updateProtection(uintptr_t addr, uintptr_t size, uint32_t prot)
{
    const uintptr_t idx = (addr>>DYNAMAP_SHIFT);
    const uintptr_t end = ((addr+size-1)>>DYNAMAP_SHIFT);
    for (uintptr_t i=idx; i<=end; ++i) {
//        #ifdef DYNAREC
//        uint32_t dyn;
//        do {
//            dyn=arm_lock_read_d(&memprot[i])&PROT_DYNAREC;
//        } while(arm_lock_write_d(&memprot[i], prot|dyn));
//        if(dyn && (prot&PROT_WRITE))    // need to remove the write protection from this block
//            mprotect((void*)(i<<DYNAMAP_SHIFT), 1<<DYNAMAP_SHIFT, prot&~PROT_WRITE);
//        #else
        uint32_t dyn=(memprot[i]&PROT_DYNAREC);
        if(dyn && (prot&PROT_WRITE))    // need to remove the write protection from this block
            mprotect((void*)(i<<DYNAMAP_SHIFT), 1<<DYNAMAP_SHIFT, prot&~PROT_WRITE);
        memprot[i] = prot|dyn;
//        #endif
    }
}

If RMSexpress freezes after that on 807519e, this is a very good sign.

@WheezyE
Copy link
Contributor Author

WheezyE commented Nov 22, 2021

Thank you for continuing to look into the dotnet35sp1 errors and for trouble-shooting.

You were using box86 with dynarec on, right?

Yes, that was with Dynarec on.

Could you check out to box86 built Jan 30, 2021 (807519e) and comment out lines 570-577 (including the latter) and line 582 in custommem.c?

I just checked-out box86 807519e, commented out those lines in box86/src/custommem.c, built and then ran the same (old / dotnet35sp1) version of RMS Express again, but the program still opens/runs, unfortunately. Since it's running, I guess that chunk of code wasn't the trouble spot.

It was a good thought! And I really appreciate your ideas. Let me know if I can test out other builds.

@bbbruni
Copy link

bbbruni commented Nov 23, 2021

We might check more new code fragments form d3d431d, which remain unreverted in main branch ;)
Could you please do what you've done in previous comment plus do the following, before building box86:
open src/dynarec/dynablock.c and modify line 273 as follows:

/* from */       for(int idx=(addr-dynablocks->maxsz)>>DYNAMAP_SHIFT; idx<addr>>DYNAMAP_SHIFT; ++idx)
/* to */        for(int idx=(addr-dynablocks->maxsz)>>DYNAMAP_SHIFT; idx<(addr>>DYNAMAP_SHIFT); ++idx)

delete lines 326, 327 and insert the following:

/* from */     if(!dynablocks->direct)
/* from */         dynablocks->direct = (dynablock_t**)calloc(dynablocks->textsz, sizeof(dynablock_t*));
/* to */    if(!dynablocks->direct) {
/* to */        dynablock_t** p = (dynablock_t**)calloc(dynablocks->textsz, sizeof(dynablock_t*));
/* to */        if(arm_lock_storeifnull(&dynablocks->direct, p)!=p)
/* to */            free(p);    // someone already create the direct array, too late...
/* to */    }

@WheezyE
Copy link
Contributor Author

WheezyE commented Nov 28, 2021

Sorry for the delay! I got busy with Thanksgiving / Native American Heritage Day preparations and holiday stuff and then for some reason, I couldn't get RMS Express to run again with my old conditions - got that figured out again though today to do more testing.

Ok, I made a fresh wineprefix with dotnet35sp1 and old RMS Express (the one that runs dotnet35sp1). I ran it successfully with old box86 again to make sure it was working. Then I checked-out box86 807519e again, commented out those lines again in box86/src/custommem.c, then changed the requested lines in src/dynarec/dynablock.c. I double-checked both files after saving to make sure that they lines were saved correctly, then built it. Running box86 --version correctly showed Box86 with Dynarec v0.2.1 807519e3 built on Nov 28 2021 17:49:21. I'm sad to report that RMS Express still runs under these conditions though.

(Side-note: I also checked-out box86 d3d431d too just to make sure I was understanding correctly - the file box86/src/custommem.c already had those lines commented out & I couldn't find the requested lines anywhere in src/dynarec/dynablock.c)

@WheezyE WheezyE changed the title Winlink (RMS Express + VARA) with Box86 dotnet35sp1 application crashes - Winlink (RMS Express, versions <1.5.41.0) Dec 11, 2021
@bbbruni
Copy link

bbbruni commented May 11, 2022

@WheezyE

Below is a guide on how I formed my equivalent patches.

Imagine a beginner C programmer John Doe.
Say, John Doe has composed a C program calculating the doubled value of a short number.
He used bitwise left shift operator to do this kind of calculation (bitwise left shift of a number by one place means multiplication of that by 2).
Say, he has a working initial file after an accomplished 'A1' commit as follows

#include <stdio.h>
int main() {
   short number;
   number = 200;
   number <<= 1; /*bitwise left shift of 200 by one place means multiplication of 200 by 2, resulting in 400*/
   
   printf("value of number is %u", number);/*it prints the product of 200 and a power of 2 until someone breaks the program*/
   return 0;
}

This was the whole program.

Then some third developer (Jim Smith) sends a buggy 'B1' commit causing data loss but John Doe doesn't know that it's buggy. Jim Smith does this by replacing short with char.
///downcasting
///

#include <stdio.h>
int main() {
   char number;
   number = 200;
   number <<= 1; /*bitwise left shift of 200 by one place means multiplication of 200 by 2, resulting in 400*/
   
   printf("value of number is %u", number);/*it prints the product of 200 and a power of 2 until someone breaks the program*/
   return 0;
}


Now John Doe decides to convert our program from multiplying the input value by 2 to multiplying that by 4. He does this by replacing <<= 1 with <<= 2

#include <stdio.h>
int main() {
   char number;
   number = 200;
   number <<= 2; /*bitwise left shift of 200 by one place means multiplication of 200 by 2, resulting in 400*/
   
   printf("value of number is %u", number);/*it prints the product of 200 and a power of 2 until someone breaks the program*/
   return 0;
}


Then John Doe forms a new 'C9' commit on top of that buggy commit, sends it and sees wrong results of the program (the regression observed was introduced by previous commit, but it's unclear for him as a beginner so far, maybe it was provoked by 'C9', maybe by 'B1')
John Doe is a C beginner and ignorant of possible data loss during bitwise operations.
He is ignorant that char type has range of valid values only from -128 to +127 (which is true in real life).
He is thus ignorant that number <<= 2; line has overfilled valid range for char type.

He conludes that for some cause bisecting is unavailable (unfeasible).

However, he wants to know what would happen if there were no 'B1' in the repository at all.
At that point of time, he doesn't know whether 'B1' or 'C9' introduced the regression.
Now he plans to seamlessly remove 'B1' from the repo to determine if 'C9' works as it should after that it has been applied directly on top of 'A1'.

So, John Doe has a task to seamlessly remove an intermediate commit between two others.

Let's have a close look at 'B1' commit to find out what prevents John Doe from removing it from his repo.

There are multiple rules to be obeyed so that it would be possible to apply some patch on top of another patch.
Firstly, let's observe some notions from the field of commits and patches.


(I don't pretend to be an expert on the subject, though)

Both a patch created with git format-patch and one created with git diff (or diff --git) effectively does the same.

The difference is that the former has some meta-information about the commit at the beginning of its text: SHA1 for the commit, time of committing, the name of the committer and his contact data, the subject of the commit (its name), the general number of files to be modified by the commit.
Some mistakes in this meta-data area (the area is absent in diff files) are usually not critical.
To give an example, one may specify wrong git-hashes and this won't hinder patches (in case the rest of the patch is correct) from being applied.

A normal way to apply the former is git-am whereas patches created with git diff or diff -u are usually applied by means of git apply.

Mistakes in the next area of a diff (or a git patch) are unallowable.

git-compatible diff file starts with diff --git a/original_file.c b/modified_file.c
the next line is index old_git_hash..new_git_hash access_mode (however, if there are mistakes in git-hashes, it won't stop the patch from being applied)
There is file information at the beginning of the area, including the full or relative path and an optional time stamp delimited by a tab character in case timestamp was specified.
The format looks as follows:

--- /src/custommem.c	1999-12-31 23:59:59.999999900 +0100

+++ /src/custommem.c	1999-12-31 23:59:59.999999900 +0100

Immediately after this info, one or more change hunks are placed.

A change hunk is comprised of range information [1]
and line modification data which are usually composed of line additions [2],
line deletions[3], and some number of the contextual lines[4].

Range information consists of one line as follows:
@@ -u,v +x,y @@ optional section heading
where
'u' stands for the ordinal number (for the file being modified) of the first (usually contextual) line in this change hunk in the

original file;
'v' stands for the sum of contextual lines and the number of line deletions in current hunk;
'x' stands for the ordinal number (for the file being modified) of the first (usually contextual) line in this change hunk after

additions and deletions have been made by previous hunks (if the current hunk is 2nd or consequent);
'y' stands for the sum of contextual lines and the number of line additions in current hunk.

The rules to be obeyed by each hunk:
Line additions are prepended with "+" (and usually highlighted in green in automatic way in specialized text editors).
Line deletions are prepended with "-" (and usually highlighted in red in automatic way in specialized text editors).
Contextual lines look like normal text lines but must be prepended by an extra space symbol.
"-0,0" in range information usually means that the original file was absolutely empty before patching.
In the first hunk, 'x' matches 'u' if it's the first hunk and file was not empty.
Default number of contextual lines is 3.
Each hunk has 3 contextual lines before any additions/deletions and 3 contextual lines after any additions/deletions.
If there was too few text lines in the original file, contextual lines of a hunk may be less than 3 or lacking.
If there's no empty new line at the very end file, i.e. the very last line in the file contains a contextual/additional/deletion line, then a new line "\ No newline at end of file" must be insterted after it. After "\ No newline at end of file" must be inserted an empty new line.

To give an example, let's imagine a text file containing just an ordinal at every new line:

1
2
3
4
5
6
7
8
9
10
11

A whole .patch file (plain .patch file, not a git-compliant one) replacing 1,2 and 10 respectively with "newline" and "yet another new line" would look as follows (two-hunk version):

--- a/src/textfile.txt
+++ b/src/textfile.txt
@@ -1,5 +1,4 @@
-1
-2
+newline
 3
 4
 5
@@ -7,5 +6,5 @@
 7
 8
 9
-10
+yet another new line
 11

A one-hunk version of that patch doing absolutely the same:

--- a/src/textfile.txt
+++ b/src/textfile.txt
@@ -1,11 +1,10 @@
-1
-2
+newline
 3
 4
 5
 6
 7
 8
 9
-10
+yet another new line
 11

Now let's look into how both two-hunk and one-hunk patches work.

Firstly, it searches for /src directory alongside the patch itself and then for textfile.txt
It reports an error in case src directory of textfile.txt is missing.
Then it parses @@ -u,v +x,y @@ line.
Note that if one composed a partly working patch, they may run into a situation where some of all of hunks are applied and others aren't.
<<<<<< or >>>>>> literals in the file to be modified are a sign of such a situation.
A usual solution is to abort the last operation.

Then it analyzes the values of -u,v.
u is the number of start line where the processing framework begins to search contextual lines or (if the ones are missing) addition or deletion ones of the hunk in the original file.
Then it compares the value of v with the actual sum of the count of contextual lines and the count of deletion lines in the hunk.
If they do not match, this part of the patch may fail. One can see <<<<<< or >>>>>> literals in the file later.

Then it analyzes the values of +x,y.
x is the number of start line where the processing framework begins to search contextual lines or (if the ones are missing) addition or deletion ones of the hunk in the file after previous hunks were applied.
Then it compares the value of y with the actual sum of the count of contextual lines and the count of addition lines in the hunk.
If they do not match, this part of the patch may fail. One can see <<<<<< or >>>>>> literals in the file later.

Then it compares the set of contextual lines of the hunk with that of actual contextual lines. After that, it compares the order of contextual lines in the hunk with that of contextual lines in the original file.
If they do not match, this part of the patch may fail.

Example of how two-hunk version of the file src/textfile.txt works:

Firstly, the parser opens file src/textfile.txt and analyzes lines starting with 1-st line of file, including the 1-st line (since the first hunk has @@ -1,). Then it checks the number of contextual and deletion lines between @@ and the end of the hunk, ignoring addition lines. -1 (deletion) is the 1st line, -2 (deletion) is the 2nd, 3 (contextual) is the 3rd, 4 (contextual) is the 4th, 5 (contextual) is the 5th. 5 lines in total, which matches ...,5 +..., which is ok. Next, the parser checks the number of contextual and addition lines between @@ and the end of the hunk, ignoring deletion lines. +newline (addition) is the 1st line, 3 (contextual) is the 2nd line, 4 (contextual) is the 3rd line, 5 (contextual) is the 4th line. 4 lines in total, which matches ...,4 @@, which is ok. Note that both -1 and +1 has number one, this is because no hunks was analyzed before and lines were not shifted by previous hunks.

*** Note that original file has lines containing 1, 2, 3, 4, 5, so this hunk can execute -1 and -2, deleting them. If the original file contained 2, 1, 3, 4, 7, this hunk would fail since it had no right lines in place (2,1,7 are mismatching lines). So this hunk succeeds and the parser goes to the next hunk. ***

In the next hunk, the parser analyzes @@ -7,5 +6,5 @@. So it sees that the lines to be modified by this hunk must start from line 7 of the original file, the parser ignores changes made by previous hunks when determining the number of line 7 for this purpose.
Then it checks the number of contextual and deletion lines between @@ and the end of the hunk, ignoring addition lines. 7 (contextual) is the 1st line in the hunk, 8 (contextual) is the 2nd, 9 (contextual) is 3rd, -10 (deletion) is 4th, 11 (contextual) is 5th. 5 lines in total, which matches @@ -7,5 ..., which is ok. Next, the parser checks the number of start line, taking into account line shift made by previous hunks. In the previous successful hunk, we had two deletion and one addition line.

So, after applying the previous hunk, the original starting line number of the current hunk in +x,y section becomes one line less. 7-1 is 6. Next, the parser checks the number of contextual and addition lines between @@ and the end of the hunk, ignoring deletion lines. 7 (contextual) is the 1st line, 8 (contextual) is the 2nd line, 9 (contextual) is the 3rd line, +yet another new line (addition) is the 4th, 11 is 5th. 5 lines in total, which matches @@... +6,5, which is ok.

Example of how one-hunk version of the file src/textfile.txt works:

Firstly, the parser opens file src/textfile.txt and analyzes lines starting with 1-st line of file, including the 1-st line (since the first hunk has @@ -1,). Then it checks the number of contextual and deletion lines between @@ and the end of the hunk, ignoring addition lines. -1 (deletion) is the 1st line, -2 (deletion) is the 2nd, 3 (contextual) is the 3rd, 4 (contextual) is the 4th, 5 (contextual) is the 5th, 6 (contextual) is the 6th, 7 (contextual) is the 7th, 8 (contextual) is the 8th, 9 (contextual) is the 9th, -10 (deletion) is the 10st line, 11 (contextual) is the 11th. 11 lines in total, which matches ...,11 +..., which is ok. Next, the parser checks the number of contextual and addition lines between @@ and the end of the hunk, ignoring deletion lines. +newline (addition) is the 1st line, 3 (contextual) is the 2th, 4 (contextual) is the 3rd, 5 (contextual) is the 4th, 6 (contextual) is the 5th, 7 (contextual) is the 6th, 8 (contextual) is the 7th, 9 (contextual) is the 8th, +yet another new line (addition) is the 9th, 11 (contextual) is the 10th. 10 lines in total, which matches ...,10 @@, which is ok.

Resulted file looks as follows

newline
3
4
5
6
7
8
9
yet another new line
11

Now, let's get back to John Doe's problem.

How can we determine which commit - B1 or C9 - has caused the problem?

We may try to look what could happen if B1 were seamlessly removed (as if B1 never existed at all and the original file were patched directly by C9).

How to see desired results of supposed removal?

At the beginning, we must find out if we can apply C9 directly on top of the original file. If we can, it's better to do so.

So, how can we see whether C9 can be applied directly without broken hunks?

There is a rule of thumb: if properly ordered contextual and deletion lines from all hunks of the patch are present in the original file to be patched (in the correct consequence!), the patch is correct and can be applied. If some deletion lines are present in hunks but miss in the original file, patch program may complain that the patch was applied before and generate a rejection.

In regard to John Doe's situation, contextual lines which present in C9 lack in the original file:

*** original file ***

#include <stdio.h>
int main() {
   short number;
   number = 200;
   number <<= 1; /*bitwise left shift of 200 by one place means multiplication of 200 by 2, resulting in 400*/
   
   printf("value of number is %u", number);/*it prints the product of 200 and a power of 2 until someone breaks the program*/
   return 0;
}

*** C9 commit ***

--- a/src/textfile.txt
+++ b/src/textfile.txt
@@ -1,9 +1,9 @@
 #include <stdio.h>
 int main() {
     char number;
     number = 200;
-    number <<= 1; /*bitwise left shift of 200 by one place means multiplication of 200 by 2, resulting in 400*/
+    number <<= 2; /*bitwise left shift of 200 by one place means multiplication of 200 by 2, resulting in 400*/
     
     printf("value of number is %u", number);/*it prints the product of 200 and a power of 2 until someone breaks the program*/
     return 0;
 }

Even though all deletion lines from C9 are present in the orginal file, we cannot apply C9 right on top of it: contextual char number; line lacks in the original file because it was brought in by B1 just before C9.

How can we modify the patch to make it appliable?

We must roll back all C9's changes made by B1 so that C9 can be applied on top of the original file in a seamless way.
We will call the new patch C9-equivalent.patch

Firstly, we need to remove all the lines added by B1.
Secondly, we need to add all the lines removed by B1.

In regard to John Doe's situation, we have to remove char number; line and insert short number; instead of it (and the rolling back is complete).
Then we have to re-calculate numbers in @@ -u,v +x,y @@ line.

*** C9-equivalent ***

--- a/src/textfile.txt
+++ b/src/textfile.txt
@@ -1,9 +1,9 @@
 #include <stdio.h>
 int main() {
-    char number;
+    short number;
     number = 200;
-    number <<= 1; /*bitwise left shift of 200 by one place means multiplication of 200 by 2, resulting in 400*/
+    number <<= 2; /*bitwise left shift of 200 by one place means multiplication of 200 by 2, resulting in 400*/
     
     printf("value of number is %u", number);/*it prints the product of 200 and a power of 2 until someone breaks the program*/
     return 0;
 }

As you can see, in essense, we combine the INVERSION of B1 and C9 into a sole patch - C9-equivalent.
Re-calculating sums of context lines plus deletion lines and context lines plus addition lines gives @@ -1,9 +1,9 @@

John Doe applies C9-equivalent.patch and sees that his program prints 800 (200 * 2 * 2 or bitwise left shift of 200 by two places) as expected. So his commit C9 is right, B1 is wrong.

@ptitSeb
Copy link
Owner

ptitSeb commented Jul 10, 2022

Does this ticket still need to be open?

@WheezyE
Copy link
Contributor Author

WheezyE commented Jul 11, 2022 via email

@WheezyE
Copy link
Contributor Author

WheezyE commented Aug 6, 2022

.NET 3.5sp1 & .NET 4.6 seem to be working with wine-mono, but there might be some network issues (I'm going to check later if those are from box86 or from wine-mono). Installing dotnet35sp1 or dotnet48 still seems to have issues.

Since RMS Express runs with wine-mono though. And since the issue kind of grew into other issues and isn't well-defined at this point, I think I'll close this and open a new issue with more specific goals.

Here's some interesting info.

RMS Express + VARA performance

  • RMS Express 1.5.13.0 (one of the last versions that used .NET 3.5 SP1) runs with wine-mono. TCP-local connection issues when trying to communicate with VARA (I'm guessing maybe a wine-mono issue?).
  • RMS Express 1.5.13.0 doesn't work with dotnet35sp1 install (no matter what strongmem and bigblock envvars)
  • RMS Express 1.6.6.0 (lastest versions - uses .NET 4.8) runs with wine-mono. TCP-local connection issues when trying to communicate with VARA (I'm guessing maybe a wine-mono issue?).

Dotnet installation attempts

  • Installing .NET 3.5 SP1 seems to work? (.NET's compoments show up in wine uninstaller).
    BOX86_DYNAREC_BIGBLOCK=0 BOX86_DYNAREC_STRONGMEM=1 BOX86_NOBANNER=1 winetricks -q dotnet35sp1. RMS
  • Installing dotnet35sp1 without any box86 envvars crashes:
double free or corruption (fasttop)
0128:err:seh:NtRaiseException Exception frame is not in stack limits => unable to dispatch exception.

Installing .NET 4.6 with or without envvars crashes (BOX86_DYNAREC_BIGBLOCK=0 BOX86_DYNAREC_STRONGMEM=1 BOX86_NOBANNER=1 winetricks -q dotnet46)

0114:fixme:secur32:GetComputerObjectNameW NameFormat 7 not implemented
double free or corruption (fasttop)
011c:fixme:security:GetWindowsAccountDomainSid (02F5F094 02973B1C 02F5F090): semi-stub
011c:fixme:secur32:GetComputerObjectNameW NameFormat 7 not implemented

Box86 with Dynarec v0.2.7 9c30029 built on Aug 5 2022 21:41:51
wine-7.4
Winlink_Express_install_1-6-6-0.zip
VARA HF v4.6.3 (also needs BOX86_NOBANNER=1 winetricks -q vb6run pdh_nt4 win7 sound=alsa)

@WheezyE WheezyE closed this as completed Aug 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants