-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
std::path::posix::Path should not automatically normalize #14028
Comments
cc @kballard |
Crap. You're right. Although I think automatically normalizing This is unfortunate, because automatically normalizing paths made a lot of things work better in the path library. But I think we can leave the current implementation in place as long as we're ok with e.g. I guess this means the path library will partially-normalize on |
Sounds right to me. I can't think of a time when normalizing |
As a side-note, I made a comment on #13721 about testing being harder due to lack of I agree with the rationale for closing #13009, but if there is some way we can have a |
There's no way for libstd to vend a As I just suggested in #13721, you can still use |
This PR implements [path reform](rust-lang/rfcs#474), and motivation and details for the change can be found there. For convenience, the old path API is being kept as `old_path` for the time being. Updating after this PR is just a matter of changing imports to `old_path` (which is likely not needed, since the prelude entries still export the old path API). This initial PR does not include additional normalization or platform-specific path extensions. These will be done in follow up commits or PRs. [breaking-change] Closes rust-lang#20034 Closes rust-lang#12056 Closes rust-lang#11594 Closes rust-lang#14028 Closes rust-lang#14049 Closes rust-lang#10035
Because of symlinks, on POSIX systems, in general you can't claim that
foo/bar/../baz
is the same path asfoo/baz
. Iffoo/bar
is a symlink with targetflip/flop
then the abspath offoo/bar/../baz
is actuallyfoo/flip/baz
. Normalizing the path symbolically changes the meaning of the path. (reducing//
to/
is still valid though)Other issues like #11650 are symptoms of this issue,
execvp
is not the only call that changes behaviour when path components are stripped out.The
std::path::posix::Path
module needs to leave the paths un-normalized internally, and re-introduce an explicitnormpath
method (distinct fromos::make_absolute
for the reasons outlined above).The text was updated successfully, but these errors were encountered: