Comment 6 for bug 411068

Revision history for this message
John A Meinel (jameinel) wrote : Re: [Bug 411068] Re: TreeTransform assumes whole tree is on one filesystem; gives "invalid cross-device link"

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Martin Pool wrote:
> 2009/9/24 Denis Golovan <email address hidden>:
>> ** Attachment added: "Patch for 1.17/1.18"
>> http://launchpadlibrarian.net/32330771/cross-partition.patch
>
> Hi, thanks for the patch. Please push up a branch and propose a merge.
>
>

I'll just do a quick comment.

Using 'shutil.move' seems nice, except instead of failing if the target
is a directory, it will move into a subdirectory.

This is the shutil code:
    real_dst = dst
    if os.path.isdir(dst):
        real_dst = os.path.join(dst, _basename(src))
        if os.path.exists(real_dst):
            raise Error, "Destination path '%s' already exists" % real_dst

^- we don't want this

v- we do what this

    try:
        os.rename(src, real_dst)
    except OSError:
        if os.path.isdir(src):
            if destinsrc(src, dst):
                raise Error, "Cannot move a directory '%s' into itself
'%s'." % (src, dst)
            copytree(src, real_dst, symlinks=True)
            rmtree(src)
        else:
            copy2(src, real_dst)
            os.unlink(src)

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkq7nfAACgkQJdeBCYSNAAPb7ACeNvXpaqyJVB0K82pGjW2E34ff
SOEAoI8YFmkTReSWUbpr4hWXi+/02970
=khPk
-----END PGP SIGNATURE-----