[MERGE] Rename on Windows is able to change filename case. (#77740)
Alexander Belchenko
bialix at ukr.net
Mon Nov 12 21:20:22 GMT 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Aaron Bentley пишет:
> Alexander Belchenko wrote:
>> Aaron Bentley ?8H5B:
>>> Alexander Belchenko wrote:
>>>> I'm also like to see the complete fix, but we need some way
>>>> to detect case-insensitivity first.
>>> I'm not sure that's true. We could handle it this way:
>>> rename target -> tmp (success)
>>> rename src -> target (failure)
>>> rename tmp -> target (success)
>>> We would be subject to race conditions, but fancy_rename already is.
>> What about this variant for fancy_rename:
>
> I like it.
>
>> + except (IOError, OSError), e:
>> + # case insensitive filesystem may be?
>> + if (not file_existed
>> + or e.errno not in (None, errno.ENOENT, errno.ENOTDIR)):
>
> Why would we get ENOTDIR?
I don't know. I simply copy-paste exception handler from the code above (rename(new,tmp)).
ENOTDIR means "Not a directory", it's linux-specific error. On Windows we always get ENOENT.
Actually on Windows+Python 2.5.1 we get WindowsError exception instead of OSError, but for some
concatenation of circumstances it has the same errno code (2) as ENOENT.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFHOMOWzYr338mxwCURApS7AKCPMFFIzxxXCY02Ik6frN/LhmCrzACcDg5E
s5hgAFMdkkCOKpyuSlhgzV0=
=K3eM
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list