Uh oh!
There was an error while loading. Please reload this page.
bpo-37612: always call linkat() from os.link(), if available - #14843
bpo-37612: always call linkat() from os.link(), if available#14843jo-he wants to merge 2 commits into
Conversation
The issue with link() is that POSIX does not define its behavior regarding symbolic links: "If path1 names a symbolic link, it is implementation-defined whether link() follows the symbolic link, or creates a new link to the symbolic link itself." And it is indeed implemented differently on Linux and NetBSD.
gnprice
commented
Aug 1, 2019
As I understand it from your bpo report, the issue is that the behavior of In particular the actual behavior on such platforms makes That sounds like a good fix to me! Would you add a test for it? See test_os.py, or perhaps test_posix.py if the test doesn't make sense to run on Windows. |
takluyver
commented
Mar 23, 2021
I've had a go at adding the test in #24997. |
The following commit authors need to sign the Contributor License Agreement: |
serhiy-storchaka
commented
May 4, 2025
Fixed by #132517. |
The issue with link() is, that POSIX does not define its behavior regarding symbolic links:
"If path1 names a symbolic link, it is implementation-defined whether link() follows the symbolic link, or creates a new link to the symbolic link itself."
And it is indeed implemented differently on e.g. Linux and NetBSD. So, it makes no sense to call link(), where linkat() is available.
https://bugs.python.org/issue37612