[issue30044] shutil.copystat should (allow to) copy ownership, and other attributes
Giampaolo Rodola'
report at bugs.python.org
Mon Jul 20 07:01:51 EDT 2020
Giampaolo Rodola' <g.rodola at gmail.com> added the comment:
Since the need to copy file ownership is common, I think there could be space for a new copy3() function which copies ownership + extended attributes (where possible). In detail:
- on Windows this can be achieved by using CopyFileEx, which would also provide better overall performances than the current readinto() implementation. This was the original approach used in BPO-33671, discarded after Eryk pointed out that ACLs should not be copied.
- on macOS we can use fcopyfile() (which is already exposed privately) + COPYFILE_ALL, see http://www.manpagez.com/man/3/fcopyfile/
- on all other UNIX we can use the current shutil.copystat() (which already copies xattrs) + os.chown(). I am not entirely sure this would achieve a "full ACLs copy" though, or what would be needed exactly to achieve that.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue30044>
_______________________________________
More information about the Python-bugs-list
mailing list