https://bugs.winehq.org/show_bug.cgi?id=49545
Bug ID: 49545 Summary: Current working directory reset to "/" on executing a winegcc/wineg++ compiled program Product: Wine Version: 5.12 Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: major Priority: P2 Component: -unknown Assignee: wine-bugs@winehq.org Reporter: sacrom@gmail.com Distribution: ---
Created attachment 67680 --> https://bugs.winehq.org/attachment.cgi?id=67680 Minimal source code showing the problem
Since Wine version 5.12 (may be 5.11) the current working directory is reset to "/" when executing a winegcc/wineg++ generated program. While in Wine 5.10 and previous versions the current working directory was the directory where the command was executed from.
I attach a really simple program that shows the issue (attached file showdir.c)
I compile the program with gcc and winegcc (in this example winegcc from Wine 5.10)
On WINE 5.10: ------------- /sc/tmp/wine $ wine --version wine-5.10 /sc/tmp/wine $ gcc -o showdir showdir.c /sc/tmp/wine $ winegcc -o showdir_wine showdir.c /sc/tmp/wine $ ls showdir showdir.c showdir_wine.exe showdir_wine.exe.so /sc/tmp/wine $ ./showdir getcwd() => /sc/tmp/wine /sc/tmp/wine $ ./showdir_wine.exe getcwd() => /sc/tmp/wine /sc/tmp/wine $ wine showdir_wine.exe.so getcwd() => /sc/tmp/wine /sc/tmp/wine $ wine start showdir_wine.exe.so getcwd() => /sc/tmp/wine
On WINE 5.12 (with the same Win 5.10 compiled files): ----------------------------------------------------- /sc/tmp/wine $ wine --version wine-5.12 /sc/tmp/wine $ ./showdir getcwd() => /sc/tmp/wine /sc/tmp/wine $ ./showdir_wine.exe getcwd() => / /sc/tmp/wine $ wine showdir_wine.exe.so getcwd() => / /sc/tmp/wine $ wine start showdir_wine.exe.so getcwd() => /sc/tmp/wine
Note: When using "wine start" sets the correct directory
Attached the full log of the previous executions in Wine_5_10.log and Wine_5_12.log