https://bugs.winehq.org/show_bug.cgi?id=46454
Bug ID: 46454 Summary: Minimalistic C++ program removing non-empty directory is not working Product: Wine Version: 4.0-rc5 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: -unknown Assignee: wine-bugs@winehq.org Reporter: contact@shaac.me Distribution: ---
Created attachment 63241 --> https://bugs.winehq.org/attachment.cgi?id=63241 The binary that works well on Windows, and less well with Wine
If Wine executes a C++ program executing `std::filesystem::remove_all`, compiled with MSVC, then it will only succeed to remove empty folders, but will silently fail if the folder is not empty. The call will not raise any error, but the folder and its content will stay on disk.
In attachment is such a program, rm.exe. If you do `rm.exe <dirname>` on wine, it will fail to delete non-empty folders. But the same command on Windows will succeed.
The only Wine terminal output, which shows both when deleting an empty folder (success) and a non empty-one (failure: bug), is: 002b:fixme:kernelbase:AppPolicyGetProcessTerminationMethod 0xfffffffffffffffa, 0x22fd10
I tested this with wine-4.0-rc5 on Archlinux. And did the Windows side of tests on a Windows 7 professional.
The program source code is:
#include <filesystem> int main(int, char** argv) { std::filesystem::remove_all(std::filesystem::path(argv[1])); }
I compiled this program with MSVC version 19.15.26732.1 for x64, with Wine, and with `/EHsc /TP /std:c++17` flags.