|
Pharo's behaviour until recently (11 Aug 2017) has been inconsistent in
canonicalising paths.
Previously Paths were canonicalised during initial creation, but are not when
extending the path with #/. Since 11 Aug (Fogbugz #13217), paths are
always canonicalised.
Neither situation is good as it can lead to incorrect results with
symbolic links, e.g. (based on Ubuntu, which has a memory based file
system at /dev/shm):
$ cd /dev/shm
$ mkdir -p d1/d2/d3/d4
$ touch d1/t1.txt d1/d2/t2.txt d1/d2/d3/t3.txt d1/d2/d3/d4/t4.txt
$ pushd d1 && ln -s d2/d3 ./s3 && popd
$ ls -l d1
total 0
drwxrwxr-x 3 alistair alistair 80 Aug 10 07:22 d2
lrwxrwxrwx 1 alistair alistair 5 Aug 10 07:22 s3 -> d2/d3
-rw-rw-r-- 1 alistair alistair 0 Aug 10 07:22 t1.txt
$ ls d1/t1.txt
d1/t1.txt
$ ls d1/s3/../t1.txt
ls: cannot access 'd1/s3/../t1.txt': No such file or directory
$ ls d1/s3/../t2.txt
d1/s3/../t2.txt
Attempting the same in Pharo:
'/dev/shm/d1' asFileReference children
" an Array(File @ /dev/shm/d1/s3 File @ /dev/shm/d1/t1.txt File @ /dev/shm/d1/d2)"
'/dev/shm/d1/t1.txt' asFileReference exists " true"
'/dev/shm/d1/s3/../t1.txt' asFileReference exists " true" -> WRONG!!!
'/dev/shm/d1/s3/../t2.txt' asFileReference exists " false" -> WRONG!!!
The soon to be added PR introduces #canonicalize to FileReference
and Path, and removes it from #resolve: and friends.
I'll add the link to the PR once I've submitted it.
Thanks,
Alistair
|
|
|
Priority: 3 – Must Fix
|
|
Status: Work Needed
|
|
Assigned to: Alistair Grant
|
|
Milestone: Pharo7.0
|
Go to Case
|
|