Skip to content

Windows: fix Dir::remove and Dir::rename following symlinks - #164559

Open
RalfJung wants to merge 2 commits into
rust-lang:mainfrom
RalfJung:dir-remove-rename-symlinks
Open

RalfJung wants to merge 2 commits into
rust-lang:mainfrom
RalfJung:dir-remove-rename-symlinks

Conversation

@RalfJung

@RalfJung RalfJung commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

Windows fs::Dir used to follow symlinks for operations that should instead act on the symlink itself. This fixes that.
Fixes #164249

try-job: test-x86_64-msvc*
Cc @ChrisDenton

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Oct 19, 2026
@RalfJung

Copy link
Copy Markdown
Member Author

@bors try

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Oct 19, 2026
ensure Dir::remove and Dir::rename do not follow symlinks

try-job: test-x86_64-msvc*
@RalfJung
RalfJung force-pushed the dir-remove-rename-symlinks branch from 19f0348 to 3cbd1f6 Compare October 19, 2026 07:47
@rust-log-analyzer

This comment has been minimized.

@rust-bors

rust-bors Bot commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

💔 Test for cad40d1 failed: CI. Failed job:

@RalfJung

Copy link
Copy Markdown
Member Author

rename also follows symlinks so that'll also need to be fixed.

@RalfJung
RalfJung force-pushed the dir-remove-rename-symlinks branch from 3cbd1f6 to 085caae Compare October 19, 2026 10:54
@RalfJung

Copy link
Copy Markdown
Member Author

@bors try

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Oct 19, 2026
ensure Dir::remove and Dir::rename do not follow symlinks

try-job: test-x86_64-msvc*
@RalfJung RalfJung changed the title ensure Dir::remove and Dir::rename do not follow symlinks Windows: fix Dir::remove and Dir::rename following symlinks Oct 19, 2026
@rust-bors

rust-bors Bot commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 5c70812 (5c70812ef7d94883981d8ea671e5cebcf84e1e29)
Base parent: 588c7e9 (588c7e92f931498b1552ee64cad77fb0344cabfa)

@RalfJung
RalfJung marked this pull request as ready for review October 19, 2026 14:13
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 19, 2026
@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Oct 19, 2026
@rustbot

rustbot commented Oct 19, 2026

Copy link
Copy Markdown
Collaborator

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @ChrisDenton, libs
  • @ChrisDenton, libs expanded to 13 candidates

Comment thread library/std/src/fs/tests.rs Outdated
@RalfJung
RalfJung force-pushed the dir-remove-rename-symlinks branch from 085caae to 84800e1 Compare October 20, 2026 06:10
@RalfJung

Copy link
Copy Markdown
Member Author

r? @ChrisDenton

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fs::Dir::remove_file and remove_dir remove the target of a symlink on Windows

6 participants