[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] Windows rename failures

From: D.J. Heap <dj_at_shadyvale.net>
Date: 2003-05-28 00:56:33 CEST

Sorry about that. Sleep shortened to 1ns, also.

Log:

Windows rename (MoveFileEx) operations will sometimes fail with
'Access Denied' when it should not -- it appears to be a race/bug
in MoveFileEx or NTFS somewhere. A short sleep and retrying the
operation finishes correctly. See the dev archives for more
information (search for MoveFileEx and/or Access Denied).

* subversion/libsvn_subr/io.c
   (svn_io_file_rename): Add a short sleep and retry if the rename
   fails in Windows with 'Access Denied.'

Index: subversion/libsvn_subr/io.c
===================================================================
--- subversion/libsvn_subr/io.c (revision 6059)
+++ subversion/libsvn_subr/io.c (working copy)
@@ -1445,6 +1445,20 @@
 
   status = apr_file_rename (from_path_apr, to_path_apr, pool);
 
+#ifdef SVN_WIN32
+ /* Due to an apparent bug in Windows, sometimes 'access denied' will be
+ returned when it should not be -- a short sleep (1ns) and retrying
+ correctly finishes the operation. See the dev mailing list archives
+ for extensive discussion and further details (search for MoveFileEx
+ and/or 'Access Denied'). */
+
+ if (status && APR_TO_OS_ERROR (status) == ERROR_ACCESS_DENIED)
+ {
+ apr_sleep (1);
+ status = apr_file_rename (from_path_apr, to_path_apr, pool);
+ }
+#endif
+
   if (status)
     return svn_error_createf (status, NULL,
                               "svn_io_file_rename: can't move '%s' to '%s'",

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed May 28 00:57:42 2003

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.