Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upTracking issue for std::fs::canonicalize #27706
Comments
alexcrichton
added
T-libs
B-unstable
A-io
labels
Aug 12, 2015
This comment has been minimized.
This comment has been minimized.
Sounds like issue in the tools rather than pathes or canonicalisation algorithm. |
This comment has been minimized.
This comment has been minimized.
|
Nominating for stabilization or deprecation in 1.5, I don't think this is likely to change any time soon so we should just make a decision. I believe the memory unsafety on Unix has been resolved in #27930, Windows returning weird things is fine, and I'm ok just documenting what syscalls this is calling. |
alexcrichton
added
the
I-nominated
label
Sep 17, 2015
This comment has been minimized.
This comment has been minimized.
|
This API is getting the canonical path for something, aka the one true path for that something. There may be multiple valid paths to get to something, due to symbolic links and such, but there is only one canonical path. Also, returning a verbatim path on Windows is the right thing to do, because the path is a valid NT path, and with the However I do wish that there was a way to get the canonical path of a file directly from a |
This comment has been minimized.
This comment has been minimized.
|
@retep998 There's no such thing as a canonical path for a EDIT: I guess Linux does have the original path symlinks in |
This comment has been minimized.
This comment has been minimized.
|
Oh, that's a good point about hard links. I shall investigate! |
This comment has been minimized.
This comment has been minimized.
|
This issue is now entering its cycle-long FCP for stabilization in 1.5 |
alexcrichton
added
final-comment-period
and removed
I-nominated
labels
Sep 24, 2015
This comment has been minimized.
This comment has been minimized.
|
The windows version of this function currently only works for files: it will fail for directories. This differs significantly from the unix implementation, which uses This should work for both files and directories on all platforms. It should also be documented that it will only work for paths that exist. |
This comment has been minimized.
This comment has been minimized.
|
Here are findings:
If you want to know whether two paths point to the same file and account for hard links, you should use |
This comment has been minimized.
This comment has been minimized.
|
Also, would we want to expose |
retep998
referenced this issue
Sep 29, 2015
Merged
Make fs::canonicalize work on directories on Windows #28729
This comment has been minimized.
This comment has been minimized.
|
Thanks for the findings and quick fixes @retep998 and @Diggsey! I'm not currently aware of a great |
This comment has been minimized.
This comment has been minimized.
|
Also a question to decide on. If we have |
This comment has been minimized.
This comment has been minimized.
|
Definitely the latter: canonicalization should (at least by default) resolve all symbolic links. To do otherwise, and resolve some but not the last one, is just asking for trouble. |
This comment has been minimized.
This comment has been minimized.
|
We probably shouldn't try to invent too many Rust-specific semantics for this kind of function, instead it may be worth taking a look at what Unix and Windows print out and then go from there. |
This comment has been minimized.
This comment has been minimized.
|
Windows will always follow symlinks unless the application indicates otherwise by passing in a special flag to |
bors
added a commit
that referenced
this issue
Sep 30, 2015
steveklabnik
added this to the 1.5 milestone
Oct 1, 2015
This comment has been minimized.
This comment has been minimized.
|
The libs team discussed this during triage today and the decision was to stabilize. |
alexcrichton
added a commit
to alexcrichton/rust
that referenced
this issue
Oct 23, 2015
bors
added a commit
that referenced
this issue
Oct 24, 2015
alexcrichton
added a commit
to alexcrichton/rust
that referenced
this issue
Oct 24, 2015
bors
added a commit
that referenced
this issue
Oct 25, 2015
alexcrichton
added a commit
to alexcrichton/rust
that referenced
this issue
Oct 25, 2015
bors
added a commit
that referenced
this issue
Oct 25, 2015
alexcrichton
added a commit
to alexcrichton/rust
that referenced
this issue
Oct 25, 2015
bors
added a commit
that referenced
this issue
Oct 25, 2015
alexcrichton
added a commit
to alexcrichton/rust
that referenced
this issue
Oct 25, 2015
bors
added a commit
that referenced
this issue
Oct 25, 2015
bors
closed this
in
#29254
Oct 25, 2015
arcnmx
added a commit
to arcnmx/rust
that referenced
this issue
Nov 2, 2015
This comment has been minimized.
This comment has been minimized.
|
Docs say this is still unstable: https://doc.rust-lang.org/stable/std/fs/fn.canonicalize.html |
This comment has been minimized.
This comment has been minimized.
|
These are stable docs. Afair stable is still 1.4.
|
This comment has been minimized.
This comment has been minimized.
|
Yes, @nagisa is correct. They'll be stable in the next release. |
This comment has been minimized.
This comment has been minimized.
|
My mistake, I was unaware how this process works. I thought if something is stable, it's already in stable release. |
This comment has been minimized.
This comment has been minimized.
|
Check out http://blog.rust-lang.org/2014/10/30/Stability.html, which explains the train model for release processes. Everything lands on nightly, then makes its way through beta and then finally into a release. We're on step 2 of that process for this particular feature. |
alexcrichton commentedAug 12, 2015
This is a tracking issue for the unstable
fs_canonicalizefeature in the standard library. There are a number of reasons it is not currently stable:Stabilizing this should probably also consider C++'s implementation as well!