Skip to content

Define fs::hard_link to not follow symlinks. #78026

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

Merged
merged 5 commits into from
Nov 9, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Make it platform-specific whether hard_link follows symlinks.
Also mention that where possible, `hard_link` does not follow symlinks.
  • Loading branch information
sunfishcode committed Oct 21, 2020
commit d0178b4f99c70d2443f9b76421429d0d23dadc45
5 changes: 3 additions & 2 deletions library/std/src/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1701,8 +1701,9 @@ pub fn copy<P: AsRef<Path>, Q: AsRef<Path>>(from: P, to: Q) -> io::Result<u64> {
/// The `dst` path will be a link pointing to the `src` path. Note that systems
/// often require these two paths to both be located on the same filesystem.
///
/// If `src` names a symbolic link, it is not followed. The created hard link
/// points to the symbolic link itself.
/// If `src` names a symbolic link, it is platform-specific whether the symbolic
/// link is followed. On platforms where it's possible to not follow it, it is
/// not followed, and the created hard link points to the symbolic link itself.
///
/// # Platform-specific behavior
///
Expand Down