subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhuij...@apache.org
Subject svn commit: r960007 - /subversion/trunk/subversion/libsvn_subr/io.c
Date Fri, 02 Jul 2010 14:33:34 GMT
Author: rhuijben
Date: Fri Jul  2 14:33:34 2010
New Revision: 960007

URL: http://svn.apache.org/viewvc?rev=960007&view=rev
Log:
* subversion/libsvn_subr/io.c
  (dir_is_empty): Add prototype.
  (svn_io_dir_remove_nonrecursive): Partially revert r879095, that disabled
    the Win32 retry loop when a directory was not empty. Instead do a check
    to see if the directory is really not empty and only then skip the
    retry loop. This should fix a race condition caused by the asynchronous
    deletion of files, which is sometimes seen when running the tests fully
    parallel.

Modified:
    subversion/trunk/subversion/libsvn_subr/io.c

Modified: subversion/trunk/subversion/libsvn_subr/io.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/io.c?rev=960007&r1=960006&r2=960007&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/io.c (original)
+++ subversion/trunk/subversion/libsvn_subr/io.c Fri Jul  2 14:33:34 2010
@@ -3117,6 +3117,10 @@ svn_io_dir_open(apr_dir_t **new_dir, con
   return SVN_NO_ERROR;
 }
 
+/* Forward declaration */
+static apr_status_t
+dir_is_empty(const char *dir, apr_pool_t *pool);
+
 
 svn_error_t *
 svn_io_dir_remove_nonrecursive(const char *dirname, apr_pool_t *pool)
@@ -3129,10 +3133,22 @@ svn_io_dir_remove_nonrecursive(const cha
   status = apr_dir_remove(dirname_apr, pool);
 
 #ifdef WIN32
-  if (APR_TO_OS_ERROR(status) != ERROR_DIR_NOT_EMPTY)
-    {
-      WIN32_RETRY_LOOP(status, apr_dir_remove(dirname_apr, pool));
-    }
+  {
+    svn_boolean_t retry = TRUE;
+
+    if (APR_TO_OS_ERROR(status) == ERROR_DIR_NOT_EMPTY)
+      {
+        apr_status_t empty_status = dir_is_empty(dirname_apr, pool);
+
+        if (APR_STATUS_IS_ENOTEMPTY(empty_status))
+          retry = FALSE;
+      }
+    
+    if (retry)
+      {
+        WIN32_RETRY_LOOP(status, apr_dir_remove(dirname_apr, pool));
+      }
+  }
 #endif
   if (status)
     return svn_error_wrap_apr(status, _("Can't remove directory '%s'"),



Mime
View raw message