Éric Araujo <mer...@netwok.org> added the comment:

> The result should be uniform; either preserve permissions across the
> board, or leave it to the mercy of the caller.
I’m surprised by this report, as the code does a copystat(sourcedir, targetdir) 
since 2004 (#1048878).  Anyhow, I think the second option would be better.

>  I know there's an enhancement request already open to supply a
> 'func=' kw argument to copytree.
This is now implemented (copy_function argument), but does not help with 
directories, only with files.  Recently I needed to call copytree and change 
the permissions of the destination, so I wanted to use a two-line custom 
copy_function (one line to call shutil.copy, one line for os.chmod), but I 
hadn’t understood that the custom function was not used for directory creation. 
 I found out that shutil does a copystat on the created directories behind my 
back.  So, I think this problem can be solved in a nice and b/w-compatible way 
by adding a new keyword argument, makedirs_func.  I would like to fix this in 
stable versions too, but if another core developer argues that it should be 
considered a new feature, I won’t argue.

----------
nosy: +eric.araujo, georg.brandl, jlgijsbers
title: shutil.copytree doesn't preserve directory permissions -> 
shutil.copytree doesn't give control over directory permissions
versions: +Python 3.3 -Python 3.1

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue1666318>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to