You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by sv...@apache.org on 2014/04/17 09:46:11 UTC

svn commit: r1588146 - in /subversion/branches/1.8.x: ./ STATUS subversion/libsvn_client/merge.c subversion/tests/cmdline/merge_tests.py

Author: svn-role
Date: Thu Apr 17 07:46:11 2014
New Revision: 1588146

URL: http://svn.apache.org/r1588146
Log:
Merge the 1.8.x-r1577812 branch:

 * r1577812, r1577813, r1579429
   Resolve a segfault when 'svn merge --force' merges a directory delete
   Justification:
     Even though this merge flag is not recommended, it shouldn't cause a
     segfault.
   Notes:
     r1577812 contains the actual fix and a regression test. r1577813 is
     a minor improvement. A branch is necessary because a comment right above
     the fix contained a typo that was fixed on trunk in a huge commit of many
     typo fixes.
   Branch:
     ^/subversion/branches/1.8.x-r1577812
   Votes:
     +1: philip, rhuijben, julianfoad

Modified:
    subversion/branches/1.8.x/   (props changed)
    subversion/branches/1.8.x/STATUS
    subversion/branches/1.8.x/subversion/libsvn_client/merge.c
    subversion/branches/1.8.x/subversion/tests/cmdline/merge_tests.py

Propchange: subversion/branches/1.8.x/
------------------------------------------------------------------------------
  Merged /subversion/branches/1.8.x-r1577812:r1577814-1588145
  Merged /subversion/trunk:r1577812-1577813,1579429

Modified: subversion/branches/1.8.x/STATUS
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/STATUS?rev=1588146&r1=1588145&r2=1588146&view=diff
==============================================================================
--- subversion/branches/1.8.x/STATUS (original)
+++ subversion/branches/1.8.x/STATUS Thu Apr 17 07:46:11 2014
@@ -336,15 +336,6 @@ Approved changes:
    Votes:
      +1: philip, rhuijben, julianfoad
 
- * r1577294
-   Make interactive conflict resolver behave as designed.
-   Justification:
-     This was intended to be the behavior form the start.  A typo in a
-     refactoring broke it.  This fix helps users avoid accidentally choosing
-     'mark resolved' and committing conflict markers.
-   Votes:
-     +1: breser, ivan, julianfoad
-
  * r1580832
    Resolve 'svnrdump load' segfault deleting an 'svn:*' property (issue #4490)
    Justification:

Modified: subversion/branches/1.8.x/subversion/libsvn_client/merge.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/libsvn_client/merge.c?rev=1588146&r1=1588145&r2=1588146&view=diff
==============================================================================
--- subversion/branches/1.8.x/subversion/libsvn_client/merge.c (original)
+++ subversion/branches/1.8.x/subversion/libsvn_client/merge.c Thu Apr 17 07:46:11 2014
@@ -3062,7 +3062,6 @@ merge_dir_deleted(const char *relpath,
   struct merge_dir_baton_t *db = dir_baton;
   const char *local_abspath = svn_dirent_join(merge_b->target->abspath,
                                               relpath, scratch_pool);
-  struct dir_delete_baton_t *delb;
   svn_boolean_t same;
   apr_hash_t *working_props;
 
@@ -3093,66 +3092,69 @@ merge_dir_deleted(const char *relpath,
                             scratch_pool, scratch_pool));
 
   if (merge_b->force_delete)
-    same = TRUE;
+    {
+      /* In this legacy mode we just assume that a directory delete
+         matches any directory. db->delete_state is NULL */
+      same = TRUE;
+    }
   else
     {
+      struct dir_delete_baton_t *delb;
+
       /* Compare the properties */
       SVN_ERR(properties_same_p(&same, left_props, working_props,
                                 scratch_pool));
-    }
+      delb = db->delete_state;
+      assert(delb != NULL);
 
-  delb = db->delete_state;
-  assert(delb != NULL);
+      if (! same)
+        {
+          delb->found_edit = TRUE;
+        }
+      else
+        {
+          store_path(delb->compared_abspaths, local_abspath);
+        }
 
-  if (! same)
-    {
-      delb->found_edit = TRUE;
-    }
-  else
-    {
-      store_path(delb->compared_abspaths, local_abspath);
-    }
+      if (delb->del_root != db)
+        return SVN_NO_ERROR;
 
-  if (delb->del_root != db)
-    return SVN_NO_ERROR;
+      if (delb->found_edit)
+        same = FALSE;
+      else
+        {
+          apr_array_header_t *ignores;
+          svn_error_t *err;
+          same = TRUE;
 
-  if (delb->found_edit)
-    same = FALSE;
-  else if (merge_b->force_delete)
-    same = TRUE;
-  else
-    {
-      apr_array_header_t *ignores;
-      svn_error_t *err;
-      same = TRUE;
+          SVN_ERR(svn_wc_get_default_ignores(&ignores, merge_b->ctx->config,
+                                             scratch_pool));
 
-      SVN_ERR(svn_wc_get_default_ignores(&ignores, merge_b->ctx->config,
-                                         scratch_pool));
+          /* None of the descendants was modified, but maybe there are
+             descendants we haven't walked?
 
-      /* None of the descendants was modified, but maybe there are
-         descendants we haven't walked?
+             Note that we aren't interested in changes, as we already verified
+             changes in the paths touched by the merge. And the existence of
+             other paths is enough to mark the directory edited */
+          err = svn_wc_walk_status(merge_b->ctx->wc_ctx, local_abspath,
+                                   svn_depth_infinity, TRUE /* get-all */,
+                                   FALSE /* no-ignore */,
+                                   TRUE /* ignore-text-mods */, ignores,
+                                   verify_touched_by_del_check, delb,
+                                   merge_b->ctx->cancel_func,
+                                   merge_b->ctx->cancel_baton,
+                                   scratch_pool);
 
-         Note that we aren't interested in changes, as we already verified
-         changes in the paths touched by the merge. And the existance of
-         other paths is enough to mark the directory edited */
-      err = svn_wc_walk_status(merge_b->ctx->wc_ctx, local_abspath,
-                               svn_depth_infinity, TRUE /* get-all */,
-                               FALSE /* no-ignore */,
-                               TRUE /* ignore-text-mods */, ignores,
-                               verify_touched_by_del_check, delb,
-                               merge_b->ctx->cancel_func,
-                               merge_b->ctx->cancel_baton,
-                               scratch_pool);
+          if (err)
+            {
+              if (err->apr_err != SVN_ERR_CEASE_INVOCATION)
+                return svn_error_trace(err);
 
-      if (err)
-        {
-          if (err->apr_err != SVN_ERR_CEASE_INVOCATION)
-            return svn_error_trace(err);
+              svn_error_clear(err);
+            }
 
-          svn_error_clear(err);
+          same = ! delb->found_edit;
         }
-
-      same = ! delb->found_edit;
     }
 
   if (same && !merge_b->dry_run)

Modified: subversion/branches/1.8.x/subversion/tests/cmdline/merge_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/tests/cmdline/merge_tests.py?rev=1588146&r1=1588145&r2=1588146&view=diff
==============================================================================
--- subversion/branches/1.8.x/subversion/tests/cmdline/merge_tests.py (original)
+++ subversion/branches/1.8.x/subversion/tests/cmdline/merge_tests.py Thu Apr 17 07:46:11 2014
@@ -19143,6 +19143,30 @@ def merge_to_empty_target_merge_to_infin
   # Commit the merge.
   #sbox.simple_commit()
 
+def merge_dir_delete_force(sbox):
+  "merge a directory delete with --force"
+
+  sbox.build()
+
+  sbox.simple_rm('A/D/G')
+  sbox.simple_commit() # r2
+
+  sbox.simple_update(revision=1)
+
+  # Just merging r2 on r1 succeeds
+  svntest.actions.run_and_verify_svn(sbox.wc_dir, None, [],
+                                     'merge', '-c2', '^/', sbox.wc_dir,
+                                     '--ignore-ancestry')
+
+  # Bring working copy to r1 again
+  svntest.actions.run_and_verify_svn(sbox.wc_dir, None, [],
+                                     'revert', '-R', sbox.wc_dir)
+
+  # But when using --force this same merge caused a segfault in 1.8.0-1.8.8
+  svntest.actions.run_and_verify_svn(sbox.wc_dir, None, [],
+                                     'merge', '-c2', '^/', sbox.wc_dir,
+                                     '--ignore-ancestry', '--force')
+
 ########################################################################
 # Run the tests
 
@@ -19288,6 +19312,7 @@ test_list = [ None,
               single_editor_drive_merge_notifications,
               conflicted_split_merge_with_resolve,
               merge_to_empty_target_merge_to_infinite_target,
+              merge_dir_delete_force,
              ]
 
 if __name__ == '__main__':