New submission from John Engelke <john.enge...@gmail.com>:

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!

----------
components: macOS
messages: 381792
nosy: john.engelke, ned.deily, ronaldoussoren
priority: normal
severity: normal
status: open
title: Pathlib resolve() on Mac Catalina prepends secret path
type: behavior
versions: Python 3.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue42458>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to