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

Tracking Issue for is_symlink #85748

Closed
3 tasks done
maxwase opened this issue May 27, 2021 · 1 comment
Closed
3 tasks done

Tracking Issue for is_symlink #85748

maxwase opened this issue May 27, 2021 · 1 comment
Labels
C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@maxwase
Copy link
Contributor

maxwase commented May 27, 2021

Feature gate: #![feature(is_symlink)]

Public API

// for `Path` and `Metadata`
pub fn is_symlink(&self) -> bool

Steps / History

Unresolved Questions

None

@maxwase maxwase added C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels May 27, 2021
bors added a commit to rust-lang-ci/rust that referenced this issue Jun 18, 2021
Path methods — symlinks improvement

This PR adds symlink method for the `Path`.

Tracking issue: rust-lang#85748
For the discussion you can see [internals topic](https://internals.rust-lang.org/t/path-methods-symlinks-improvement/14776)

P.S.
I'm not fully sure about `stable` attribute, correct me if I'm wrong.
@marcospb19
Copy link
Contributor

My thoughts on the unresolved questions:

Does exists() or try_exists() method work correctly? How do we implement these for symlinks?

Every function in std::fs is supposed to follow links, except for the ones who contain link name in it:

  1. fs::metadata_symlink
  2. fs::hard_link
  3. fs::read_link

Assuming this pattern is consistent in all library stable functions, I'd say exists() and try_exists() are implemented correctly, they fail if there is a broken link at the path.

If we had exists_symlink() and try_exists_symlink(), I'd assume they both return true for broken links.


Linked issues: fs::Metadata::is_dir() and is_file() should be deprecated #76487

I created that issue when I was confused why there wasn't a is_symlink available for fs::Metadata, as seen by the feedback given, people prefer those methods to not be deprecated, as they are useful shorthands to metadata's filetype methods, I agree, and I believe that Path::is_symlink and Metadata::is_symlink would be just as useful.

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Oct 31, 2021
…=joshtriplett

Stabilize `is_symlink()` for `Metadata` and `Path`

I'm not fully sure about `since` version, correct me if I'm wrong

Needs update after stabilization: [cargo-test-support](https://github.com/rust-lang/cargo/blob/8063672238a5b6c3a901c0fc17f3164692d0be85/crates/cargo-test-support/src/paths.rs#L202)

Linked issue: rust-lang#85748
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Oct 31, 2021
…=joshtriplett

Stabilize `is_symlink()` for `Metadata` and `Path`

I'm not fully sure about `since` version, correct me if I'm wrong

Needs update after stabilization: [cargo-test-support](https://github.com/rust-lang/cargo/blob/8063672238a5b6c3a901c0fc17f3164692d0be85/crates/cargo-test-support/src/paths.rs#L202)

Linked issue: rust-lang#85748
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Oct 31, 2021
…=joshtriplett

Stabilize `is_symlink()` for `Metadata` and `Path`

I'm not fully sure about `since` version, correct me if I'm wrong

Needs update after stabilization: [cargo-test-support](https://github.com/rust-lang/cargo/blob/8063672238a5b6c3a901c0fc17f3164692d0be85/crates/cargo-test-support/src/paths.rs#L202)

Linked issue: rust-lang#85748
@maxwase maxwase closed this as completed Oct 31, 2021
bors added a commit to rust-lang/cargo that referenced this issue Jan 13, 2022
Use `is_symlink()` method

I've came across this comment
```rust
// Replace with std implementation when stabilized, see
// rust-lang/rust#85748
```
and fixed this due to the method stabilization in 1.58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants