Skip to content

Harmonize shutil.copymode() on Windows and POSIX #113188

Closed
@serhiy-storchaka

Description

@serhiy-storchaka

The behavior of shutil.copymode() on Windows was changed by adding os.lchmod() in #59616. Now if follow_symlinks is false and both src and dst are symlinks, it copies the symlink mode (only the read-only bit). Previously it did nothing.

But there is still a difference between Windows and POSIX. If follow_symlinks is true and dst is a symlink, it sets the permission of the symlink on Windows (because os.chmod() still does not follow symlinks by default on Windows) and the permission of the target on POSIX.

shutil.copystat() has different behavior, because it passes the follow_symlinks argument explicitly.

I propose to harmonize shutil.copymode() behavior on Windows with POSIX and with shutil.copystat().

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions