Skip to content

Commit 2a16521

Browse files
committed
make sure file copies are consistent e.g. during Archive creation to try hard to avoid timestamp differences between metadata and on disk versions.
git-svn-id: svn+ssh://svn.code.sf.net/p/migrid/code/trunk@6044 b75ad72c-e7d7-11dd-a971-7dbc132099af
1 parent 340ccf7 commit 2a16521

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

mig/shared/fileio.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -617,14 +617,16 @@ def _copy_helper(src, dst, configuration, recursive):
617617
"""Copy a file or directory from src to dst where dst must be a new
618618
file/dir path and the parent dir is created if necessary. The recursive
619619
flag enables recursive copy.
620+
We use the same 'copy2' helper for single file copies as for the recursive
621+
copytree case to always transfer metadata, too.
620622
"""
621623
dst_dir = os.path.dirname(dst)
622624
makedirs_rec(dst_dir, configuration)
623625
try:
624626
if recursive:
625627
shutil.copytree(src, dst)
626628
else:
627-
shutil.copy(src, dst)
629+
shutil.copy2(src, dst)
628630
except Exception as exc:
629631
return (False, "copy %r %r failed: %s" % (src, dst, exc))
630632
return (True, "")

0 commit comments

Comments
 (0)