https://bugs.winehq.org/show_bug.cgi?id=57376
Bug ID: 57376 Summary: Permission denied vs No such file or directory when opening folders with trailing backslash Product: Wine Version: 9.20 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: -unknown Assignee: wine-bugs@winehq.org Reporter: alex+winehq@cogarr.net Distribution: ---
Created attachment 77346 --> https://bugs.winehq.org/attachment.cgi?id=77346 A zip file containing a minimal example.c, and log files wine.txt and win.txt
There's a subtle difference when calling fopen(3) between Wine configured for win10, and real Windows 10. When attempting to open a folder (e.g. AppData), wine correctly sets errno to 13 (Permission denied), but when opening a folder with a trailing backslash(e.g. AppData), Windows sets errno to 2 (No such file or directory) while Wine sets it to 13 (Permission denied). The attached example.c shows this behavior. I compile it with mingw32-x86_64-gcc and run it through cmd.exe with my current directory set to C:\users\user on Wine and get wine.txt, then run it on Windows 10, and get win.txt (COPY a.exe C:\users\user && C: && cd users\user && a.exe > win[e].txt)
This behavior exists on current Wine 9.20 and has existed since at least Wine 9.0 . I have tried the winecfg versions: win10, win11, win8.1, vista, and all seem to work the same.
My actual use case is running the Luarocks package manager(https://github.com/luarocks/luarocks) compiled for Windows on Wine for testing. Luarocks uses this behavior to check if something is a folder (https://github.com/luarocks/luarocks/blob/master/src/luarocks/fs/win32.lua#L...).
https://bugs.winehq.org/show_bug.cgi?id=57376
Fabian Maurer dark.shadow4@web.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |testcase CC| |dark.shadow4@web.de Ever confirmed|0 |1 Status|UNCONFIRMED |NEW
--- Comment #1 from Fabian Maurer dark.shadow4@web.de --- Thanks for the report, I created a MR here: https://gitlab.winehq.org/wine/wine/-/merge_requests/6759
https://bugs.winehq.org/show_bug.cgi?id=57376
--- Comment #2 from Fabian Maurer dark.shadow4@web.de --- Created attachment 77355 --> https://bugs.winehq.org/attachment.cgi?id=77355 Testcase