You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2011/04/25 18:45:44 UTC

svn commit: r1096512 - /subversion/trunk/subversion/libsvn_wc/workqueue.c

Author: hwright
Date: Mon Apr 25 16:45:44 2011
New Revision: 1096512

URL: http://svn.apache.org/viewvc?rev=1096512&view=rev
Log:
Fix a bug when syncing file flags with properties.

In spite of the name, directories are perfectly valid targets of this work
queue action, and when doing so on *nix, interesting things can happen.
Because most directories don't have an explicit svn:executable property
set on them, invoking this action on a directory will *remove* the eXecute
bit, which causes all kinds of havoc for the unsuspecting user.

So, we just special case directories, by only removing the execute bits if
the node in question isn't a directory.  Arguably, this is a bit inefficient
as currently implemented, but at least it is Correct.

(And for good measure, don't even bother with the whole mess if we're on
Windows.)

* subversion/libsvn_wc/workqueue.c
  (sync_file_flags): Check to see if we're looking at a directory before
    attempting to remove the eXecute bit.

Modified:
    subversion/trunk/subversion/libsvn_wc/workqueue.c

Modified: subversion/trunk/subversion/libsvn_wc/workqueue.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/workqueue.c?rev=1096512&r1=1096511&r2=1096512&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/workqueue.c (original)
+++ subversion/trunk/subversion/libsvn_wc/workqueue.c Mon Apr 25 16:45:44 2011
@@ -89,17 +89,29 @@ sync_file_flags(svn_wc__db_t *db,
 {
   svn_boolean_t did_set;
 
+  SVN_DBG(("here: '%s'\n", local_abspath));
   SVN_ERR(svn_wc__maybe_set_read_only(&did_set, db, local_abspath,
                                       scratch_pool));
   if (!did_set)
     SVN_ERR(svn_io_set_file_read_write(local_abspath, FALSE, scratch_pool));
 
+#ifndef WIN32
   SVN_ERR(svn_wc__maybe_set_executable(&did_set, db, local_abspath,
                                        scratch_pool));
 
   if (!did_set)
-    SVN_ERR(svn_io_set_file_executable(local_abspath, FALSE, FALSE,
-                                       scratch_pool));
+    {
+      svn_node_kind_t kind;
+
+      SVN_ERR(svn_io_check_path(local_abspath, &kind, scratch_pool));
+
+      /* We want to preserve whatever execute bits may be existent on
+         directories. */
+      if (kind != svn_node_dir)
+        SVN_ERR(svn_io_set_file_executable(local_abspath, FALSE, FALSE,
+                                           scratch_pool));
+    }
+#endif
 
   return SVN_NO_ERROR;
 }