New submission from Maor Feldinger <[email protected]>:
Reproduction Steps:
-------------------
Create a symlink in a directory without permissions:
>>> from pathlib import Path
>>>
>>> target = Path('/tmp/tmp/target')
>>>
>>>
>>>
>>>
>>> src = Path('/tmp/tmp/src')
>>>
>>>
>>>
>>>
>>> src.symlink_to(target)
Actual:
-------
Permission error shows reversed order:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/rh/rh-python38/root/usr/lib64/python3.8/pathlib.py", line 1382, in
symlink_to
if self._closed:
File "/opt/rh/rh-python38/root/usr/lib64/python3.8/pathlib.py", line 445, in
symlink
def symlink(a, b, target_is_directory):
PermissionError: [Errno 13] Permission denied: '/tmp/tmp/target' ->
'/tmp/tmp/src'
Expected:
---------
Same as os.symlink the permission error should show the right symlink order:
>>> import os
>>>
>>> os.symlink(str(src), str(target))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
PermissionError: [Errno 13] Permission denied: '/tmp/tmp/src' ->
'/tmp/tmp/target'
----------
messages: 401996
nosy: dfntlymaybe
priority: normal
severity: normal
status: open
title: Misleading error message when pathlib.Path.symlink_to() fails with
permissions error
type: behavior
versions: Python 3.8
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue45226>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com