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

[PATCH] Workaround for missing ERROR_DIRECTORY constant in APR

From: Wolfgang Stengel <wolfgang.stengel_at_efactory.de>
Date: Thu, 01 Oct 2009 16:35:53 +0200

Hello Subversion team,

please consinder the attached patch. Some file systems (for example NFS)
produce a different error code on Windows than that which is handled by
APR natively. This results in a number of problems with Subversion, for
example the function svn_wc_check_wc() does not fail correctly on
inexistant files.

The attached patch provides a simple workaround. It mappes the
error code ERROR_DIRECTORY to the error code ERROR_PATH_NOT_FOUND which
can be caught by the APR_STATUS_IS_ENOTDIR() macro. The patch also
checks if the constant ERROR_DIRECTORY even exists and if the problem
in APR has been fixed in the meantime (by checking if
APR_STATUS_IS_ENOENT() or APR_STATUS_IS_ENOTDIR() already catch
ERROR_DIRECTORY).

Thank you for your opinions on this.

Wolfgang

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2402548

[[[
Workaround for missing generic constant in APR for Windows specific i/o
error code ERROR_DIRECTORY. ERROR_DIRECTORY will be changed to
ERROR_PATH_NOT_FOUND so that it can be detected through APR_STATUS_IS_ENOTDIR.

* subversion/libsvn_subr/error.c
  (make_error_internal): Replace ERROR_DIRECTORY error code by
  ERROR_PATH_NOT_FOUND so that it can be detected by APR_STATUS_IS_ENOTDIR.
]]]
Index: subversion/libsvn_subr/error.c
===================================================================
--- subversion/libsvn_subr/error.c (revision 39738)
+++ subversion/libsvn_subr/error.c (working copy)
@@ -88,6 +88,12 @@
         abort();
     }
 
+#ifdef ERROR_DIRECTORY
+ /* Workaround for missing ERROR_DIRECTORY equivalent in APR. */
+ if (apr_err == (APR_OS_START_SYSERR + ERROR_DIRECTORY) && ! APR_STATUS_IS_ENOENT(apr_err) && ! APR_STATUS_IS_ENOTDIR(apr_err))
+ apr_err = APR_OS_START_SYSERR + ERROR_PATH_NOT_FOUND;
+#endif
+
   /* Create the new error structure */
   new_error = apr_pcalloc(pool, sizeof(*new_error));
 
Received on 2009-10-01 16:36:04 CEST

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