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, ned.deily, ronaldoussoren
Date 2020-11-25.05:42:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1606282979.63.0.164554102879.issue42458@roundup.psfhosted.org>
In-reply-to
Content
On Mac OS X Catalina+, Pathlib's resolve() method prepends the System Integrity Protection (SIP) path to the front of the resolved Path, whether you like it or not. 

>>> 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')
>>> import platform
>>> platform.platform()
'Darwin-19.6.0-x86_64-i386-64bit'
>>> import sys
>>> print (sys.version)
3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 16:52:21) 
[Clang 6.0 (clang-600.0.57)]
>>> 

In my particular case, I'm just using this feature to resolve paths for an FTP host, so the path is contrived and doesn't actually exist locally. As one may guess, this breaks my FTP transfers by foisting a path on me that isn't on the server. 

I know there are other tix for Pathlib's erratic behavior across platforms which don't talk about this specific issue. I don't think it a behavior across platforms thing, anyway. Pathlib obviously isn't behaving nicely with SIP and Apple's Firmlink wormhole like directory traversal stuffs. Oy vey!
History
Date User Action Args
2020-11-25 05:42:59john.engelkesetrecipients: + john.engelke, ronaldoussoren, ned.deily
2020-11-25 05:42:59john.engelkesetmessageid: <1606282979.63.0.164554102879.issue42458@roundup.psfhosted.org>
2020-11-25 05:42:59john.engelkelinkissue42458 messages
2020-11-25 05:42:59john.engelkecreate