Closed
Description
If os.path.realpath()
encounters a symlink loop on posix, it prematurely stops querying paths and resolving symlink targets. This differs from coreutils realpath
:
$ cd /tmp
$ ln -s loop loop
$ ln -s target link
$ realpath -m loop/../link
/tmp/target
$ python -c 'import os.path; print(os.path.realpath("loop/../link"))'
/tmp/link
It also differs from how lstat()
errors are handled:
$ realpath -m missing/../link
/tmp/target
$ python -c 'import os.path; print(os.path.realpath("missing/../link"))'
/tmp/target