Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

bpo-37612: always call linkat() from os.link(), if available#14843

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
jo-he wants to merge2 commits intopython:mainfromjo-he:master

Conversation

@jo-he
Copy link
Contributor

@jo-hejo-he commentedJul 18, 2019
edited by bedevere-bot
Loading

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

The issue with link() is that POSIX does not define its behaviorregarding symbolic links:"If path1 names a symbolic link, it is implementation-defined whetherlink() follows the symbolic link, or creates a new link to the symboliclink itself."And it is indeed implemented differently on Linux and NetBSD.
@gnprice
Copy link
Contributor

As I understand it from your bpo report, the issue is that the behavior ofos.link doesn't match its documentation on some platforms (in particular Linux), and this fixes things so that it does.

In particular the actual behavior on such platforms makesfollow_symlinks=True useless, even when explicitly specified, so that's definitely a bug. (Also you located the relevant provision in POSIX and found that Linux's behavior here is perfectly compliant.)

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
Copy link
Contributor

I've had a go at adding the test in#24997.

@python-cla-bot
Copy link

The following commit authors need to sign the Contributor License Agreement:

CLA signed

@serhiy-storchaka
Copy link
Member

Fixed by#132517.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

7 participants

@jo-he@gnprice@takluyver@serhiy-storchaka@the-knights-who-say-ni@ezio-melotti@bedevere-bot

[8]ページ先頭

©2009-2025 Movatter.jp