Joerg Sonnenberger <jo...@netbsd.org> added the comment: A better approach might be to change the function to:
def copystat(src, dst): st = os.stat(src) st_dst = os.stat(dst) mode = stat.S_IMODE(st.st_mode) mode_dst = stat.S_IMODE(st_dst.st_mode) if hasattr(os, 'utime'): if st.st_atime != st_dst.st_atime or st.st_mtime != st_dst.st_mtime os.utime(dst, (st.st_atime, st.st_mtime)) if hasattr(os, 'chmod'): if mode != mode_dst: os.chmod(dst, mode) if hasattr(os, 'chflags') and hasattr(st, 'st_flags'): if st.st_flags != st_dst.st_flags: os.chflags(dst, st.st_flags) This avoids the system calls for the (common) case of not having to change anything at all. Given that the flags are normally not set, it also avoids the problem with NFS. ---------- nosy: +joerg _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue7512> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com