[issue37157] shutil: add reflink=False to file copy functions to control clone/CoW copies (use copy_file_range)

Giampaolo Rodola' report at bugs.python.org
Wed Jun 5 06:22:17 EDT 2019


Giampaolo Rodola' <g.rodola at gmail.com> added the comment:

> I'm not sure that attempt to call unlink() if FICLONE fails is a good idea
Agreed.


> I dislike the *fallback* parameter of reflink().

Me too. A specific exception is better.


> Why not exposing clonefile() as os.clonefile() but os._clonefile()?

Mmm... I'm not sure it's worth it. The only reason one may want to use clonefile() directly is for passing CLONE_NOFOLLOW and CLONE_NOOWNERCOPY flags (the only possible ones):
 
- CLONE_NOFOLLOW can be exposed via "follow_symlinks=True" (like other shutil.* functions) and used internally
- CLONE_NOOWNERCOPY should also be passed internally by default because all other functions of shutil do not copy ownership (there's a warning at the top of the doc), so I think it makes sense for reflink() to do the same.
 

> +#if defined(MAC_OS_X_VERSION_10_12): Would it be possible to use a runtime check?

Good point. It should definitively be loaded at runtime. I will look into that (but not soon).

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37157>
_______________________________________


More information about the Python-bugs-list mailing list