]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-81793: Always call linkat() from os.link(), if available (GH-132517)
authorSerhiy Storchaka <storchaka@gmail.com>
Sun, 4 May 2025 14:24:10 +0000 (17:24 +0300)
committerGitHub <noreply@github.com>
Sun, 4 May 2025 14:24:10 +0000 (17:24 +0300)
commit5a57248b22ad3b9aafcaaadae2c304a1923daeca
tree473d9a8cefc0069b2e59c93fc67cf924dba3e381
parente9253ebf74433de5ae6d7f1bce693a3a1173b3b1
gh-81793: Always call linkat() from os.link(), if available (GH-132517)

This fixes os.link() on platforms (like Linux and OpenIndiana) where the
system link() function does not follow symlinks.

* On Linux, it now follows symlinks by default and if
  follow_symlinks=True is specified.
* On Windows, it now raises error if follow_symlinks=True is passed.
* On macOS, it now raises error if follow_symlinks=False is passed and
  the system linkat() function is not available at runtime.
* On other platforms, it now raises error if follow_symlinks is passed
  with a value that does not match the system link() function behavior
  if if the behavior is not known.

Co-authored-by: Joachim Henke <37883863+jo-he@users.noreply.github.com>
Co-authored-by: Thomas Kluyver <takowl@gmail.com>
Doc/library/os.rst
Lib/test/test_inspect/test_inspect.py
Lib/test/test_posix.py
Misc/NEWS.d/next/Library/2025-04-14-17-24-50.gh-issue-81793.OhRTTT.rst [new file with mode: 0644]
Modules/clinic/posixmodule.c.h
Modules/posixmodule.c