Reputation: 4877
The documentation of os.path.normpath
reads the following:
This string manipulation may change the meaning of a path that contains symbolic links.
What cases and examples are applicable here where the meaning would change? Where would the application of this function be unsafe and what are the workarounds?
Upvotes: 4
Views: 1167
Reputation: 6190
Disclaimer: I am not 100% sure on this and don't have access to a *nix system right now to check. You'll probably want to check, or wait till commenters tell me I'm right or wrong ;-)
That said, here's my answer:
In the given example A/foo/../B
-> A/B
. If there are no symlinks, everything is fine.
Using the same example, lets say:
So:
A/foo/../B
means "the directory B, which is in the parent directory of A/foo".A/foo/../B
actually refers to /X/B
.In this case the normalisation of A/foo/../B
to /A/B
is incorrect, it should normalise to /X/B
.
Upvotes: 3