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
https://bugs.winehq.org/show_bug.cgi?id=49545
--- Comment #1 from Marcos Gutiérrez Batz sacrom@gmail.com --- Created attachment 67681 --> https://bugs.winehq.org/attachment.cgi?id=67681 Wine 5.10 execution with all messages
https://bugs.winehq.org/show_bug.cgi?id=49545
--- Comment #2 from Marcos Gutiérrez Batz sacrom@gmail.com --- Created attachment 67682 --> https://bugs.winehq.org/attachment.cgi?id=67682 Wine 5.12 execution with all messages
https://bugs.winehq.org/show_bug.cgi?id=49545
Marcos Gutiérrez Batz sacrom@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|Current working directory |Current working directory |reset to "/" on executing a |reset to "/" executing a |winegcc/wineg++ compiled |winegcc/wineg++ compiled |program |program
https://bugs.winehq.org/show_bug.cgi?id=49545
Marcos Gutiérrez Batz sacrom@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |sacrom@gmail.com
https://bugs.winehq.org/show_bug.cgi?id=49545
--- Comment #3 from Marcos Gutiérrez Batz sacrom@gmail.com --- I've tested so far Wine 5.12 in Ubuntu 18.04, Ubuntu 20.04 and Linux Mint 19
It fails in all cases
https://bugs.winehq.org/show_bug.cgi?id=49545
--- Comment #4 from Alexandre Julliard julliard@winehq.org --- Note that previously it was reset to "/" only on removable drives, but that means you couldn't rely on it either. What are you using this for?
https://bugs.winehq.org/show_bug.cgi?id=49545
--- Comment #5 from Marcos Gutiérrez Batz sacrom@gmail.com --- I'm one of the developers of a CLI/GUI aplication.
We have a programing language and generate a binary intermediate file with our compiler. We can then execute the intermediate file with an interpreter in diferent platforms (semthing like Java).
We have a text based interpreter that has always worked in Windows (DOS box)/ Unix and Linux.
We implemented a Graphical interpreter based in the Win32 API (Windows). So now we are using a WineLib compiled interpreter to execute the graphical interpreter in Linux. This interpreter uses the normal Linux code for threads, files sytem handling... and just using the the Windows code for the Graphical part.
Having said that we execute the application like that:
$ app.exe intermedite_filename
app.exe has to open the intermediate file, but as the current directory has been reset the file can't be opened (the full path has to be specified)
One workaround is to modify the app.exe wrapper and add "/start" option, but every time we compile the program the wrapper need to be modified.
https://bugs.winehq.org/show_bug.cgi?id=49545
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Fixed by SHA1| |cdaa72c728df3c80499c8a4f59e | |731f353347db0 Keywords| |regression Status|UNCONFIRMED |RESOLVED
--- Comment #6 from Alexandre Julliard julliard@winehq.org --- This should be fixed by cdaa72c728df3c80499c8a4f59e731f353347db0.
https://bugs.winehq.org/show_bug.cgi?id=49545
Nikolay Sivov bunglehead@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Component|-unknown |ntdll
https://bugs.winehq.org/show_bug.cgi?id=49545
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #7 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 6.0-rc4.