This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author thomaswaldmann
Date 2007-03-24.18:07:06
SpamBayes Score
Marked as misclassified
I can confirm this bug.

For MoinMoin wiki, we solved that by duplicating this function to our own tree and we did exactly the proposed change:
Adding a simple copystat(src, dst) on line 112 of (right below os.mkdir) fixes this problem.

I also suggest to remove that XXX comment in that function. With the proposed fix, it gets usable and thus is not only example code any more.

BUT: for avoiding problems on win32, a second fix needs to be done. For MoinMoin, we call this wrapper around shutil.copystat from our copytree function:

def copystat(src, dst):
    """Copy stat bits from src to dst

    This should be used when shutil.copystat would be used on directories
    on win32 because win32 does not support utime() for directories.

    According to the official docs written by Microsoft, it returns ENOACCES if the
    supplied filename is a directory. Looks like a trainee implemented the function.
    if sys.platform == 'win32' and S_ISDIR(os.stat(dst)[ST_MODE]):
        if == 'nt':
            st = os.stat(src)
            mode = S_IMODE(st[ST_MODE])
            if hasattr(os, 'chmod'):
                os.chmod(dst, mode) # KEEP THIS ONE!
        #else: pass # we are on Win9x,ME - no chmod here
        shutil.copystat(src, dst)

As you see, some special treatment is needed for win32/nt and directories - and directories are exactly the use case used by the fixed copytree, so a fixed copystat is needed or copytree will crash on win32/nt.
Date User Action Args
2007-08-23 14:52:02adminlinkissue1666318 messages
2007-08-23 14:52:02admincreate