-
Notifications
You must be signed in to change notification settings - Fork 673
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
Open read-only file with FILE_FLAG_DELETE_ON_CLOSE flag #1255
Comments
Hi @denisovpi , Thanks for pointing that out! Lines 250 to 254 in 2165b60
I agree that the order shouldn't affect the behavior but the rule is actually to return the most precise and correct status for the operation. |
Hi, @Liryna, |
Thanks @denisovpi ! Please ping me on te rust PR 👍 I will be glad to review it |
Environment
Check List
Description
I'm working on implementing our own file system. I took dokan_memfs as an example. The file creation function has two checks for specific conditions:
Cannot delete a file with readonly attributes.
dokany/samples/dokan_memfs/memfs_operations.cpp
Lines 134 to 138 in 2165b60
Cannot open a readonly file for writing.
dokany/samples/dokan_memfs/memfs_operations.cpp
Lines 140 to 145 in 2165b60
I noticed that if I change the order of these two conditions, the code will no longer pass the tests. This also happened with the implementation of the dokan-rust-memfs. I created an issue.
I think that the implementation of external file systems should not affect the logic of the Dokany itself. This is a bug or this case should be described in the documentation or in the code example itself.
Tests for winfstest
expect("CreateDirectory %s 0" % name, 0)
expect("CreateFile %s\\f GENERIC_WRITE 0 0 CREATE_ALWAYS FILE_ATTRIBUTE_READONLY 0" % name, 0)
expect("CreateFile %s\\f GENERIC_WRITE 0 0 OPEN_EXISTING FILE_FLAG_DELETE_ON_CLOSE 0" % name, "ERROR_ACCESS_DENIED")
Output:
not ok 3 - expect "CreateFile M:\81981b9e\f GENERIC_WRITE 0 0 OPEN_EXISTING FILE_FLAG_DELETE_ON_CLOSE 0" ERROR_ACCESS_DENIED - got 0
The text was updated successfully, but these errors were encountered: