-
Notifications
You must be signed in to change notification settings - Fork 19
Dir::open("a_file") succeeds #27
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
Comments
By looking at history, it looks like it might be a deliberate decision at some point (there is a test which is reversed). But unfortunately it was early on for the project, there is no issue to cite for a motivation. I need to think about it more. In case we want to fix it, what's your use case? Just to make sure I understand the problem. |
When I first looked at the code (0.1.18, via docs.rs), I noticed that the Then I noticed that it was changed to The flag Thus, if Moreover, IMHO, on those platforms where |
This should resolve tailhook#27. It does not fix it by adding a expensive stat() check on opening, but by giving the opportunity to explicitly check a Dir handle. When really required a programmer can enforce consistency between platforms by using 'is_dir()'. Failing to do so won't cause any harm because improper handles (on platforms without O_DIRECTORY) would report errors at later time. This also removes the test_open_file() test from the testsuite, as it depended on presence of O_DIRECTORY which makes he testsuite non deterministic testing only where its oblivious that the OS wouldn't open files as directories.
Should Dir::open succeeds when it's given a file?
The text was updated successfully, but these errors were encountered: