Skip to content

Refuse reparse points when creating files on Windows - #749

Merged
n33miaz merged 2 commits into
developfrom
fix/740-create-file-reparse
Dec 6, 2026
Merged

n33miaz merged 2 commits into
developfrom
fix/740-create-file-reparse

Conversation

@n33miaz

@n33miaz n33miaz commented Dec 6, 2026

Copy link
Copy Markdown
Owner

Closes #740

What changes

Node::create_file (Windows) now passes FILE_OPEN_REPARSE_POINT and
shares the new file for reading only (FILE_SHARE_READ), mirroring
create_private_file. A reparse point under the name is treated as the
existing entry it is: the creation is refused with Error::Exists and
the link is never followed.

Before this change, an NtCreateFile with the FILE_CREATE disposition
and no FILE_OPEN_REPARSE_POINT followed a pending file symbolic link
and created the file at its target, outside the fence. The only caller
(write_new in disk.rs) keeps its error contract: Exists maps to
DestinationTaken, anything else to an io stop.

How to validate

  • cargo test -p ads-adapter-fs (all suites green).
  • cargo fmt --all --check and cargo clippy -p ads-adapter-fs --all-targets clean.
  • Regression test: crates/adapters/fs/tests/sys.rs::a_pending_file_link_is_refused_not_followed_on_create fails without the fix — with the fix reverted, the call follows the pending link and creates the target outside the fence instead of refusing it, so both the Exists assertion 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 the fs-windows CI job.

Risks

Low. Behavior only narrows: names that are reparse points now fail with
Exists instead of being followed; the tighter share mode only denies
concurrent writers while the creator's handle is open, which no caller
depends on. The hunk is adjacent to the create_private_file change
from #739; syncing with develop may need a trivial textual merge
resolution (both sides add the same flags).

Signed-off-by: Neemias Cormino Manso <130704790+n33miaz@users.noreply.github.com>
Signed-off-by: Neemias Cormino Manso <130704790+n33miaz@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Dec 6, 2026

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@n33miaz
n33miaz merged commit be0e27e into develop Dec 6, 2026
17 checks passed
@n33miaz
n33miaz deleted the fix/740-create-file-reparse branch December 6, 2026 03:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refuse reparse points in Node::create_file on Windows

1 participant