You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
shutil.copytree: Give the option to disable copystat #89721
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:
assignee=Noneclosed_at=Nonecreated_at=<Date2021-10-21.20:20:18.081>labels= ['type-feature', 'library', '3.11']
title='shutil.copytree: Give the option to disable copystat'updated_at=<Date2021-11-27.23:01:38.428>user='https://github.com/doronbehar'
Can you provide a description of what motivated you to change the behavior or what benefits this change would have for you or others? Do you know why others haven’t reported this need previously?
doronbehar commented on Nov 27, 2021
doronbeharmannequin
MannequinAuthor
More actions
Can you provide a description of what motivated you to change the behavior or what benefits this change would have for you or others?
Sometimes, you wish to copy a whole directory from a read-only file system and you don't want it to be read-only in the destination.
Do you know why others haven’t reported this need previously?
On NixOS all of the files that belong to packages are read-only. I encountered the need for this feature in GNURadio, at:
Facing this issue as well. Various Python software uses shutil.copytree to initialize state directories from a skeleton directory shipped with the software. With mutable package managers, all the files in package directories are read-write, so the problem doesn't become apparent. In the case of Nix and other package managers that install packages into immutable locations, this causes a surprising breakage. shutil.copytree already provide an argument copy_function, which allows disabling this behavior for files, but directories always get their permissions copied.
Activity
jaraco commentedon Nov 26, 2021
Can you provide a description of what motivated you to change the behavior or what benefits this change would have for you or others? Do you know why others haven’t reported this need previously?
doronbehar commentedon Nov 27, 2021
Sometimes, you wish to copy a whole directory from a read-only file system and you don't want it to be read-only in the destination.
On NixOS all of the files that belong to packages are read-only. I encountered the need for this feature in GNURadio, at:
gnuradio/gnuradio#5227
The following Stack overflow question also suggests the need for this functionality is a bit common:
https://stackoverflow.com/a/17022146/4935114
max-privatevoid commentedon Mar 3, 2023
Facing this issue as well. Various Python software uses
shutil.copytreeto initialize state directories from a skeleton directory shipped with the software. With mutable package managers, all the files in package directories are read-write, so the problem doesn't become apparent. In the case of Nix and other package managers that install packages into immutable locations, this causes a surprising breakage.shutil.copytreealready provide an argumentcopy_function, which allows disabling this behavior for files, but directories always get their permissions copied.InvokeAI: ad-hoc patch init script to avoid wrong permissions
pythongh-89721: Skip copy_dir_stat tests without working chmod
pythongh-89721: Address review: kw-only flag, clearer docs, time asserts