[issue42458] Pathlib resolve() on Mac Catalina prepends secret path

2020-11-25 Thread John Engelke


Change by John Engelke :


--
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42458] Pathlib resolve() on Mac Catalina prepends secret path

2020-11-25 Thread John Engelke


John Engelke  added the comment:

Thanks @ronaldoussoren. This bug report is flawed for a couple reasons, 
notwithstanding some assumptions I made incorrectly. (SIP actually makes 
"/home" a symlink so that resolved correctly.) So I am retracting it as-is 
because I can't edit the original report. 

The documentation for the behavior of resolve() is talking about using 
resolve() in the PurePath section. And, resolve() is removing "/../" when the 
path doesn't really exist locally. I'll open clearer tickets about those when I 
have a chance.

--
resolution:  -> not a bug

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42458] Pathlib resolve() on Mac Catalina prepends secret path

2020-11-25 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

I'm not sure if I understand what you're trying to do.

Is host_path_str a path on the local machine, or a path on the FTP server?

For the latter you probably want to use "PurePosixpath" instead of "Path", the 
latter is intended to be used for local paths and can access the filesystem.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42458] Pathlib resolve() on Mac Catalina prepends secret path

2020-11-24 Thread John Engelke


New submission from John Engelke :

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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com