-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
provide posix semantics for uv_fs_unlink on Windows #3839
Comments
Interesting find. My Cliffs notes:
|
Possibly also a similar change for rename using SetFileInformationByHandle with FileRenameInfoEx and FILE_RENAME_FLAG_POSIX_SEMANTICS, though curiously the microsoft employees rejected using it to fix their stl bugs listed here microsoft/STL#2053 for being less-posix-compliant than our current implementation |
Just adding @vtjnash's helpful comment from here
|
Possibly due to C++20, there are now documented flags that force posix-compliant behavior on Windows when deleting a file. It is not documented when this was added to the Windows kernel. (It is also possible the behavior of DeleteFile and/or DeleteFileEx has changed according to random user comments on the internet, although the documentation for those functions still claim not to provide posix-behavior here.) But while browsing the documentation site, I discovered it is now possible to request posix-compatible deletion semantics via:
https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/ntddk/ns-ntddk-_file_disposition_information_ex
We can infer some of the dates where this is first available from the comments on the official C++20 STL implementation (apache-2 license), such as microsoft/STL#1559
1809 | Redstone 5 | October 2018 Update (added FILE_DISPOSITION_FLAG_IGNORE_READONLY_ATTRIBUTE)
1607 | Redstone | Anniversary Update (added FILE_DISPOSITION_FLAG_POSIX_SEMANTICS)
It is then possible to detect the error if these functions/types are not available at runtime for the filesystem or operating system, and fallback to the current code.
The text was updated successfully, but these errors were encountered: