You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Path x semantically (i.e. resolve and then normalize) points to Dotdot, but normalize returns Dot. The reason is our implementation of normalize does
|Link_, ItemDotdot -> ItemDot
which moves up through the link. This definition agrees with my shell's behavior (where the prompt is configured to show the current working directory):
~/phat-test $ ln -s . a
~/phat-test $ ls -al
lrwx------ 1 ashish staff 1B Dec 11 11:08 a ->.~/phat-test $ cd a
~/phat-test/a $ cd ..
~/phat-test $
The shell treats a as a regular directory. Doing a cd moves you to it, with PWD showing you one level lower in your directory tree, even though a points to the current directory. This isn't necessarily wrong, but doesn't align with our goal for normalize, which is that normalization shouldn't change a path's semantics. The shell could reasonably have implemented an alternative, that cding to a link takes you to its target, but there is an attempt here at letting users leave the link unresolved. Presumably this is more intuitive in some cases.
I would use normalize in `reify` to avoid dealing with Dot and
Dotdot. In particular I would follow (rel) links by concatenating with
the dirname of the link and its target (correct) then normalize
(incorrect, at least till #18 is not addressed).
This commit removes uses of `normalize` and deals with Dot and Dotdot
cases (which were not difficult at all, in the end).
Path
x
semantically (i.e. resolve and then normalize) points toDotdot
, butnormalize
returnsDot
. The reason is our implementation ofnormalize
doeswhich moves up through the link. This definition agrees with my shell's behavior (where the prompt is configured to show the current working directory):
The shell treats
a
as a regular directory. Doing acd
moves you to it, with PWD showing you one level lower in your directory tree, even thougha
points to the current directory. This isn't necessarily wrong, but doesn't align with our goal for normalize, which is that normalization shouldn't change a path's semantics. The shell could reasonably have implemented an alternative, thatcd
ing to a link takes you to its target, but there is an attempt here at letting users leave the link unresolved. Presumably this is more intuitive in some cases.Originally reported by @pveber.
The text was updated successfully, but these errors were encountered: