MSYS2-packages/subversion/05-retry-loop.patch
2020-05-30 09:02:52 +03:00

81 lines
2.5 KiB
Diff

Use WIN32 retry loop on Cygwin, too.
From: David Rothenberger <daveroth@acm.org>
---
subversion/libsvn_subr/io.c | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/subversion/libsvn_subr/io.c b/subversion/libsvn_subr/io.c
index 9d6db8f..4262c75 100644
--- a/subversion/libsvn_subr/io.c
+++ b/subversion/libsvn_subr/io.c
@@ -29,6 +29,10 @@
#include <unistd.h>
#endif
+#ifdef __CYGWIN__
+#include <errno.h>
+#endif
+
#ifndef APR_STATUS_IS_EPERM
#include <errno.h>
#ifdef EPERM
@@ -136,6 +140,12 @@
|| os_err == ERROR_SHARING_VIOLATION \
|| os_err == ERROR_DIR_NOT_EMPTY), \
1)
+#elif defined(__CYGWIN__)
+#define WIN32_RETRY_LOOP(err, expr) \
+ RETRY_LOOP(err, expr, (os_err == EBUSY \
+ || os_err == EACCES \
+ || os_err == ENOTEMPTY), \
+ 1)
#else
#define WIN32_RETRY_LOOP(err, expr) ((void)0)
#endif
@@ -2900,6 +2910,7 @@ svn_io_remove_file2(const char *path,
apr_err = apr_file_remove(path_apr, scratch_pool);
+#if defined(WIN32) || defined(__CYGWIN__)
#ifdef WIN32
/* If the target is read only NTFS reports EACCESS and FAT/FAT32
reports EEXIST */
@@ -2910,10 +2921,14 @@ svn_io_remove_file2(const char *path,
SVN_ERR(svn_io_set_file_read_write(path, ignore_enoent, scratch_pool));
apr_err = apr_file_remove(path_apr, scratch_pool);
}
-
+#endif
/* Check to make sure we aren't trying to delete a directory */
+#ifdef WIN32
if (apr_err == APR_FROM_OS_ERROR(ERROR_ACCESS_DENIED)
|| apr_err == APR_FROM_OS_ERROR(ERROR_SHARING_VIOLATION))
+#else
+ if (apr_err == APR_FROM_OS_ERROR(EACCES))
+#endif
{
apr_finfo_t finfo;
@@ -4570,6 +4585,9 @@ svn_io_file_rename2(const char *from_path, const char *to_path,
}
#else
status = apr_file_rename(from_path_apr, to_path_apr, pool);
+#ifdef __CYGWIN__
+ WIN32_RETRY_LOOP(status, apr_file_rename(from_path_apr, to_path_apr, pool));
+#endif
#endif /* WIN32 || __OS2__ */
if (status)
@@ -4702,7 +4720,7 @@ dir_make(const char *path, apr_fileperms_t perm,
/* Windows does not implement sgid. Skip here because retrieving
the file permissions via APR_FINFO_PROT | APR_FINFO_OWNER is documented
to be 'incredibly expensive'. */
-#ifndef WIN32
+#if !defined(WIN32) && !defined(__CYGWIN__)
if (sgid)
{
apr_finfo_t finfo;