Caring for stat of files, but modifying stat of dirs is
maybe not what's expected from that function.
I discovered that when implementing a new function in
MoinMoin when it changed directory modes from
-rw-rw---- to -rw-------.
It is easy to fix:
$ diff -u shutil.py shutil.py-tw
--- shutil.py 2004-10-17 23:19:25.000000000 +0200
+++ shutil.py-tw 2004-10-18 00:01:57.000000000 +0200
@@ -109,6 +109,7 @@
"""
names = os.listdir(src)
os.mkdir(dst)
+ copystat(src, dst)
errors = []
for name in names:
srcname = os.path.join(src, name)
Maybe it is even better to do that copystat after the
for loop (and thus, after the recursive calls modifying
the timestamp of the directory) and before the if
statement, so it may even conserve the dir timestamp (I
didn't test that).
It happens in 2.3.4 as well as in 2.4 beta 1.
Strictly taken, it is not a bug, as the docs say
nothing about what it does to directories. But well,
maybe just the docs need to be changed as well. :)
|