Skip to content
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

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

Merged
merged 5 commits into from
Nov 9, 2020

Commits on Oct 16, 2020

  1. Define fs::hard_link to not follow symlinks.

    POSIX leaves it implementation-defined whether `link` follows symlinks.
    In practice, for example, on Linux it does not and on FreeBSD it does.
    So, switch to `linkat`, so that we can pick a behavior rather than
    depending on OS defaults.
    
    Pick the option to not follow symlinks. This is somewhat arbitrary, but
    seems the less surprising choice because hard linking is a very
    low-level feature which requires the source and destination to be on
    the same mounted filesystem, and following a symbolic link could end
    up in a different mounted filesystem.
    sunfishcode committed Oct 16, 2020
    Configuration menu
    Copy the full SHA
    91a9f83 View commit details
    Browse the repository at this point in the history

Commits on Oct 18, 2020

  1. Fix a typo in a comment.

    sunfishcode committed Oct 18, 2020
    Configuration menu
    Copy the full SHA
    23a5c21 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    ce00b3e View commit details
    Browse the repository at this point in the history

Commits on Oct 21, 2020

  1. Make it platform-specific whether hard_link follows symlinks.

    Also mention that where possible, `hard_link` does not follow symlinks.
    sunfishcode committed Oct 21, 2020
    Configuration menu
    Copy the full SHA
    d0178b4 View commit details
    Browse the repository at this point in the history

Commits on Oct 24, 2020

  1. Disable use of linkat on Android as well.

    According to [the bionic status page], `linkat` has only been available
    since API level 21. Since Android is based on Linux and Linux's `link`
    doesn't follow symlinks, just use `link` on Android.
    
    [the bionic status page]: https://android.googlesource.com/platform/bionic/+/master/docs/status.md
    sunfishcode committed Oct 24, 2020
    Configuration menu
    Copy the full SHA
    6249cda View commit details
    Browse the repository at this point in the history