--- shutil.py.orig 2012-06-18 13:14:00.000000000 +0200 +++ shutil.py 2012-06-18 14:14:02.000000000 +0200 @@ -80,7 +80,10 @@ raise SpecialFileError("`%s` is a named pipe" % fn) with open(src, 'rb') as fsrc: - with open(dst, 'wb') as fdst: + dstfd = os.open(dst, os.O_WRONLY | os.O_NOFOLLOW | os.O_CREAT, 0) + if hasattr(os, 'fchmod'): + os.fchmod(dstfd, 0) + with os.fdopen(dstfd, 'wb') as fdst: copyfileobj(fsrc, fdst) def copymode(src, dst):