[bug] ABCL should not auto-normalize `..` found in pathname directory components
I maintain a filepath-handling library, and during some tests noticed that ABCL is over-aggressive about how it handles .. on Unix systems. In particular, it seems to be confusing the difference between :up and :back as described in the spec here.
The issue is that in general, for some given filepath, due to the possibility of symlinks, .. cannot be resolved without a filesystem probe. ABCL is not doing such a probe, but instead assuming that all .. are treated as :back. The perhaps safer thing to do is simply insert a :up where ever a .. is seen, which it seems to only being doing when the previously processed path component was not a string.
Example:
(pathname "/foo/bar/.././../baz/test.json")
=> #P"/foo/baz/test.json"
whereas I would have expected #P"/foo/bar/.././../baz/test.json".
Inspect output:
A pathname.
Namestring: "/foo/baz/test.json"
Host: NIL
Device: NIL
Directory: (:ABSOLUTE "foo" "baz")
Name: "test"
Type: "json"
Version: NIL
This occurs in calls to pathname and in usage of #p pathname literals.
Related https://github.com/Clozure/ccl/issues/477
Shouldn't it give
#P"/baz/test.json"
Because of symlinks, there's no way to guarantee that transformation.