Repository navigation
Refuse reparse points when creating files on Windows - #749
Merged
Merged
Conversation
Signed-off-by: Neemias Cormino Manso <130704790+n33miaz@users.noreply.github.com>
Signed-off-by: Neemias Cormino Manso <130704790+n33miaz@users.noreply.github.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #740
What changes
Node::create_file(Windows) now passesFILE_OPEN_REPARSE_POINTandshares the new file for reading only (
FILE_SHARE_READ), mirroringcreate_private_file. A reparse point under the name is treated as theexisting entry it is: the creation is refused with
Error::Existsandthe link is never followed.
Before this change, an
NtCreateFilewith theFILE_CREATEdispositionand no
FILE_OPEN_REPARSE_POINTfollowed a pending file symbolic linkand created the file at its target, outside the fence. The only caller
(
write_newindisk.rs) keeps its error contract:Existsmaps toDestinationTaken, anything else to an io stop.How to validate
cargo test -p ads-adapter-fs(all suites green).cargo fmt --all --checkandcargo clippy -p ads-adapter-fs --all-targetsclean.Existsassertion and the "nothing planted outside" assertion fail. Note: the test skips on machines where Windows refuses symbolic-link creation (missing privilege, developer mode off), as the sibling link tests already do; the failing/passing evidence comes from thefs-windowsCI job.Risks
Low. Behavior only narrows: names that are reparse points now fail with
Existsinstead of being followed; the tighter share mode only deniesconcurrent writers while the creator's handle is open, which no caller
depends on. The hunk is adjacent to the
create_private_filechangefrom #739; syncing with
developmay need a trivial textual mergeresolution (both sides add the same flags).