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 dfntlymaybe
Recipients dfntlymaybe
Date 2021-09-17.01:06:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1631840762.01.0.206152391874.issue45226@roundup.psfhosted.org>
In-reply-to
Content
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'
History
Date User Action Args
2021-09-17 01:06:02dfntlymaybesetrecipients: + dfntlymaybe
2021-09-17 01:06:02dfntlymaybesetmessageid: <1631840762.01.0.206152391874.issue45226@roundup.psfhosted.org>
2021-09-17 01:06:01dfntlymaybelinkissue45226 messages
2021-09-17 01:06:01dfntlymaybecreate