[Python-Dev] os.rename on windows
draghuram at gmail.com
Tue May 1 16:40:19 CEST 2007
On 5/1/07, Scott Dial <scott+python-dev at scottdial.com> wrote:
> The cygwin implementation of rename goes like this:
> 1) Try to use MoveFile
> 2) Try to use MoveFileEx(..., MOVEFILE_REPLACE_EXISTING)
> 3) Try to unlink destination, then try to use MoveFile
> And as you say, Cygwin claims it meets POSIX.1. And, POSIX.1 says, "If
> newpath already exists it will be atomically replaced (subject to
> a few conditions; see ERRORS below), so that there is no point at which
> another process attempting to access newpath will find it missing."
> Clearly, unliking and then calling MoveFile is not atomic. So, cygwin is
> not being honest here because in these less frequent cases, the rename
> will not be atomic.
You are right. I just checked cygwin's rename() code and it is
convincing enough for me to withdraw the patch.
Thanks for all the comments.
More information about the Python-Dev