Skip to content

Document behavior of fs::copy when source is a symlink - #165995

Open
MarioIlRosso wants to merge 1 commit into
rust-lang:mainfrom
MarioIlRosso:issue-141034-fix
Open

MarioIlRosso wants to merge 1 commit into
rust-lang:mainfrom
MarioIlRosso:issue-141034-fix

Conversation

@MarioIlRosso

@MarioIlRosso MarioIlRosso commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Addresses #141034.
Added a paragraph to std::fs::copy, explaining that if from is a symlink, it will copy the referent of the link, and also suggest an alternative in case the user of the function wants to copy the symlink.

@rustbot label T-libs A-filesystem

@rustbot rustbot added A-filesystem Area: `std::fs` 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. labels Nov 15, 2026
@rustbot

rustbot commented Nov 15, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the pull request, and welcome! The Rust Project has assigned @Mark-Simulacrum (or someone else) to review your changes, you should hear from them (or someone else) within the next two weeks.

Please see the contribution instructions and our LLM policy for more information.

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @ChrisDenton, libs
  • @ChrisDenton, libs expanded to 38 candidates
  • Random selection from JohnTitor, Mark-Simulacrum, clarfonthey, maxdexh

@maxdexh

maxdexh commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

Should this be platform dependent behavior? Or do we gurarantee that any platform that has anything that behaves like a symlink will act this way?

@MarioIlRosso

Copy link
Copy Markdown
Contributor Author

Should this be platform dependent behavior? Or do we gurarantee that any platform that has anything that behaves like a symlink will act this way?

I mostly read #141034 (comment) and just assumed it was the same for all platforms

@Mark-Simulacrum Mark-Simulacrum added S-waiting-on-t-libs Status: Awaiting decision from T-libs and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 22, 2026
@Mark-Simulacrum

Copy link
Copy Markdown
Member

Re-tagging to libs to see if we know this is broadly true or how we want to document the behavior.

@clarfonthey

Copy link
Copy Markdown
Contributor

Yeah, I would at least expect tests to verify this holds.

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

A-filesystem Area: `std::fs` S-waiting-on-t-libs Status: Awaiting decision from T-libs 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.

5 participants