You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ph...@apache.org on 2015/01/21 23:41:24 UTC

svn commit: r1653680 - in /subversion/trunk/subversion: libsvn_subr/io.c tests/libsvn_subr/io-test.c

Author: philip
Date: Wed Jan 21 22:41:24 2015
New Revision: 1653680

URL: http://svn.apache.org/r1653680
Log:
Make the ignore-enoent flag behaviour consistent across the
functions that support it, and consistent across all platforms.

* subversion/libsvn_subr/io.c
  (io_set_file_perms, svn_io_set_file_read_only,
   svn_io_remove_dir2): Have ignore-enoent flag ignore ENOTDIR so
   Unix behaviour is like Windows.

* subversion/tests/libsvn_subr/io-test.c
  (ignore_enoent): Expect calls to succeed on all platforms.

Modified:
    subversion/trunk/subversion/libsvn_subr/io.c
    subversion/trunk/subversion/tests/libsvn_subr/io-test.c

Modified: subversion/trunk/subversion/libsvn_subr/io.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/io.c?rev=1653680&r1=1653679&r2=1653680&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/io.c (original)
+++ subversion/trunk/subversion/libsvn_subr/io.c Wed Jan 21 22:41:24 2015
@@ -1590,7 +1590,8 @@ io_set_file_perms(const char *path,
   status = apr_stat(&finfo, path_apr, APR_FINFO_PROT | APR_FINFO_LINK, pool);
   if (status)
     {
-      if (ignore_enoent && APR_STATUS_IS_ENOENT(status))
+      if (ignore_enoent && (APR_STATUS_IS_ENOENT(status)
+                            || SVN__APR_STATUS_IS_ENOTDIR(status)))
         return SVN_NO_ERROR;
       else if (status != APR_ENOTIMPL)
         return svn_error_wrap_apr(status,
@@ -1951,7 +1952,8 @@ svn_io_set_file_read_only(const char *pa
                               pool);
 
   if (status && status != APR_ENOTIMPL)
-    if (!ignore_enoent || !APR_STATUS_IS_ENOENT(status))
+    if (!(ignore_enoent && (APR_STATUS_IS_ENOENT(status)
+                            || SVN__APR_STATUS_IS_ENOTDIR(status))
       return svn_error_wrap_apr(status,
                                 _("Can't set file '%s' read-only"),
                                 svn_dirent_local_style(path, pool));
@@ -2552,7 +2554,8 @@ svn_io_remove_dir2(const char *path, svn
   if (err)
     {
       /* if the directory doesn't exist, our mission is accomplished */
-      if (ignore_enoent && APR_STATUS_IS_ENOENT(err->apr_err))
+      if (ignore_enoent && (APR_STATUS_IS_ENOENT(err->apr_err)
+                            || SVN__APR_STATUS_IS_ENOTDIR(err->apr_err)))
         {
           svn_error_clear(err);
           return SVN_NO_ERROR;

Modified: subversion/trunk/subversion/tests/libsvn_subr/io-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_subr/io-test.c?rev=1653680&r1=1653679&r2=1653680&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_subr/io-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_subr/io-test.c Wed Jan 21 22:41:24 2015
@@ -723,33 +723,14 @@ ignore_enoent(apr_pool_t *pool)
                            pool));
   SVN_ERR(svn_io_file_close(file, pool));
 
-#define ASSERT_ENOTDIR(exp) {                                           \
-    svn_error_t *svn__err = (exp);                                      \
-    SVN_TEST_ASSERT(svn__err);                                          \
-    SVN_TEST_ASSERT(SVN__APR_STATUS_IS_ENOTDIR(svn__err->apr_err));     \
-    svn_error_clear(svn__err);                                          \
-}
-
   /* Path does not exist as child of file. */
-  /* ### Some return SUCCESS others ENOTDIR, is that what we want? */
   path = svn_dirent_join(path, "not-present", pool);
-#ifdef WIN32
   SVN_ERR(svn_io_remove_dir2(path, TRUE, NULL, NULL, pool));
-#else
-  ASSERT_ENOTDIR(svn_io_remove_dir2(path, TRUE, NULL, NULL, pool));
-#endif
   SVN_ERR(svn_io_remove_file2(path, TRUE, pool));
-#ifdef WIN32
   SVN_ERR(svn_io_set_file_read_only(path, TRUE, pool));
   SVN_ERR(svn_io_set_file_read_write(path, TRUE, pool));
   SVN_ERR(svn_io_set_file_executable(path, TRUE, TRUE, pool));
   SVN_ERR(svn_io_set_file_executable(path, FALSE, TRUE, pool));
-#else
-  ASSERT_ENOTDIR(svn_io_set_file_read_only(path, TRUE, pool));
-  ASSERT_ENOTDIR(svn_io_set_file_read_write(path, TRUE, pool));
-  ASSERT_ENOTDIR(svn_io_set_file_executable(path, TRUE, TRUE, pool));
-  ASSERT_ENOTDIR(svn_io_set_file_executable(path, FALSE, TRUE, pool));
-#endif
   SVN_ERR(svn_io_stat_dirent2(&dirent_p, path, TRUE, TRUE, pool, pool));
   SVN_ERR(svn_io_stat_dirent2(&dirent_p, path, FALSE, TRUE, pool, pool));