Repository navigation
os.chmod() does not follow symlinks on Windows #59616
Description
Activity
atsuoishimoto commented
on Jul 21, 2012 atsuoishimotomannequinMannequinAuthorMore actionsos.chmod() should check symlinks if followsymlinks option is True on Windows.
This is a cause of failure of test case
test.test_shutil.TestShutil.test_copymode_follow_symlinks
- addedstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement
on Jul 21, 2012 atsuoishimoto commented
on Jul 21, 2012 atsuoishimotomannequinMannequinAuthorMore actionsPatch updated. Check symlinks only if supported by platform.
Can we have a patch review on this please as it's holding up bpo-13837.
Unfortunately, the patch by @atsuoishimoto is too old and cannot be applied to the current code. The difference is so larger, that it is easier to write a new code from scratch than try to resolve conflicts iteratively.
Which I did. My PR uses a different approach. Instead of resolving the symlink path, it opens a handle and changes file attributes by the handle (it is the recommended way). In future it may be possible to implement also
os.fchmod().Reacted by Steve Dower and Atsuo Ishimoto- added a commit that references this issue
on Dec 14, 2023 Now
os.chmod()supportsfollow_symlinks=Trueon Windows. But by default it does not follow symlinks. Few versions later (in 3.15 or later) we can change the default. It will allow users to useos.lchmod()oros.chmod(follow_symlinks=False)if they need the old behavior, and it will work in several versions.- added a commit that references this issue
on Feb 11, 2024
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
Linked PRs