This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author john.engelke
Recipients john.engelke
Date 2020-11-25.16:07:28
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1606320449.29.0.994355220822.issue42464@roundup.psfhosted.org>
In-reply-to
Content
The below snippet results in the symlink "/home" resolving as expected. However, documentation at https://docs.python.org/3.7/library/pathlib.html#pathlib.Path.resolve suggests, "If strict is False, the path is resolved as far as possible and any remainder is appended without checking whether it exists."

>>> from pathlib import Path
>>> host_path_str = "/home/somewhere/there/../nowhere"
>>> host_path = Path(host_path_str)
>>> host_path
PosixPath('/home/somewhere/there/../nowhere')
>>> host_path.resolve()
PosixPath('/System/Volumes/Data/home/somewhere/nowhere')

Expected results (based on the wording above): 

>>> host_path.resolve()
PosixPath('/System/Volumes/Data/home/somewhere/there/../nowhere')

Right now the ".." pieces are universally removed. I'm not exactly sure exactly how symlinks resolve, but this might create unexpected results. 

No part of the path component "somewhere/there/../nowhere" exists. When strict=True this would yield an error. So when strict=False, and it doesn't resolve, documentation implies that would be re-added to the resolved section.
History
Date User Action Args
2020-11-25 16:07:29john.engelkesetrecipients: + john.engelke
2020-11-25 16:07:29john.engelkesetmessageid: <1606320449.29.0.994355220822.issue42464@roundup.psfhosted.org>
2020-11-25 16:07:29john.engelkelinkissue42464 messages
2020-11-25 16:07:28john.engelkecreate