-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Windows: Use FindFirstFileW
for getting the metadata of locked system files
#98916
Conversation
Usually opening a file handle with access set to metadata only will always succeed, even if the file is locked. However some special system files, such as `C:\hiberfil.sys`, are locked by the system in a way that denies even that. So as a fallback we try reading the cached metadata from the directory.
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
This is, as far as I can tell, equivalent to the code in the Microsoft STL: https://github.com/microsoft/STL/blob/062002644137095c606f0a5a11d04f0278e8632e/stl/src/filesystem.cpp#L794 (and so is likely to be correct) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry it took so long to get to this. This looks good to me.
@bors r+ |
Windows: Use `FindFirstFileW` for getting the metadata of locked system files Fixes rust-lang#96980 Usually opening a file handle with access set to metadata only will always succeed, even if the file is locked. However some special system files, such as `C:\hiberfil.sys`, are locked by the system in a way that denies even that. So as a fallback we try reading the cached metadata from the directory. Note that the test is a bit iffy. I don't know if `hiberfil.sys` actually exists in the CI. r? rust-lang/libs
Windows: Use `FindFirstFileW` for getting the metadata of locked system files Fixes rust-lang#96980 Usually opening a file handle with access set to metadata only will always succeed, even if the file is locked. However some special system files, such as `C:\hiberfil.sys`, are locked by the system in a way that denies even that. So as a fallback we try reading the cached metadata from the directory. Note that the test is a bit iffy. I don't know if `hiberfil.sys` actually exists in the CI. r? rust-lang/libs
Windows: Use `FindFirstFileW` for getting the metadata of locked system files Fixes rust-lang#96980 Usually opening a file handle with access set to metadata only will always succeed, even if the file is locked. However some special system files, such as `C:\hiberfil.sys`, are locked by the system in a way that denies even that. So as a fallback we try reading the cached metadata from the directory. Note that the test is a bit iffy. I don't know if `hiberfil.sys` actually exists in the CI. r? rust-lang/libs
@bors r- failed in rollup Oh, I was afraid of this. |
Oof, I thought about marking it as rollup=never for that reason (I guess doing a try run would have been more prudent...) Marking the test as ignore makes sense to me. |
The file it's testing does not exist in the CI environment.
It seems a bit goofy to do a try run now that the test is ignored, so I'll just reapprove. @bors r+ |
Sorry, we already noticed that and addressed the issue. @bors r=thomcc |
Rollup of 5 pull requests Successful merges: - rust-lang#98784 (Suggest returning local on "expected `ty`, found `()`" due to expr-less block) - rust-lang#98916 (Windows: Use `FindFirstFileW` for getting the metadata of locked system files) - rust-lang#99433 (Erase regions before comparing signatures of foreign fns.) - rust-lang#99452 (int_macros was only using to_xe_bytes_doc and not from_xe_bytes_doc) - rust-lang#99481 (Add regression test for rust-lang#71547) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Fixes #96980
Usually opening a file handle with access set to metadata only will always succeed, even if the file is locked. However some special system files, such as
C:\hiberfil.sys
, are locked by the system in a way that denies even that. So as a fallback we try reading the cached metadata from the directory.Note that the test is a bit iffy. I don't know if
hiberfil.sys
actually exists in the CI.r? rust-lang/libs