Skip to content

Clarify the behavior of std::fs::hard_link when the second path already exists #130186

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

Closed
3mp8r3 opened this issue Sep 10, 2024 · 1 comment
Closed
Labels
C-bug Category: This is a bug.

Comments

@3mp8r3
Copy link

3mp8r3 commented Sep 10, 2024

Regarding std::fs::hard_link function (https://doc.rust-lang.org/std/fs/fn.hard_link.html)

The function currently doesn't specify what happens if the second parameter (link / "the destination") already exists.

The note for Unix systems and Linux's man pages suggests it will return an error in this case. However, I don't think one should have to read Linux man pages to determine the behavior of a Rust function. It's also not clear if this is the intended Rust behavior across platforms or if the behavior would be platform-specific.

Assuming it's not platform-specific, I think it would be sufficient to add a bullet point to the # Errors section as a second documented error case.

@3mp8r3 3mp8r3 added the C-bug Category: This is a bug. label Sep 10, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Sep 10, 2024
@ChrisDenton
Copy link
Member

ChrisDenton commented Sep 10, 2024

Closing as exact duplicate of #130117

@ChrisDenton ChrisDenton closed this as not planned Won't fix, can't repro, duplicate, stale Sep 10, 2024
@ChrisDenton ChrisDenton removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug.
Projects
None yet
Development

No branches or pull requests

3 participants