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 2022/03/30 05:42:07 UTC

svn commit: r1899377 - in /subversion/branches/1.14.x: ./ STATUS subversion/libsvn_client/conflicts.c subversion/libsvn_wc/wc_db.c subversion/tests/cmdline/merge_tree_conflict_tests.py

Author: svn-role
Date: Wed Mar 30 05:42:07 2022
New Revision: 1899377

URL: http://svn.apache.org/viewvc?rev=1899377&view=rev
Log:
Merge the r1892470 group from trunk:

 * r1892470, r1892471, r1892541
   Fix an assertion failure triggered by the conflict resolver.
   Justification:
     Subversion should not crash. User complained.
   Votes:
     +1: stsp, markphip, rhuijben
     +0: dsahlberg (test suite passes for 'check', 'davautocheck' and
         'svnserveautocheck'. Not enough C experience for a formal
         review)

Modified:
    subversion/branches/1.14.x/   (props changed)
    subversion/branches/1.14.x/STATUS
    subversion/branches/1.14.x/subversion/libsvn_client/conflicts.c
    subversion/branches/1.14.x/subversion/libsvn_wc/wc_db.c
    subversion/branches/1.14.x/subversion/tests/cmdline/merge_tree_conflict_tests.py

Propchange: subversion/branches/1.14.x/
------------------------------------------------------------------------------
  Merged /subversion/trunk:r1892470-1892471,1892541

Modified: subversion/branches/1.14.x/STATUS
URL: http://svn.apache.org/viewvc/subversion/branches/1.14.x/STATUS?rev=1899377&r1=1899376&r2=1899377&view=diff
==============================================================================
--- subversion/branches/1.14.x/STATUS (original)
+++ subversion/branches/1.14.x/STATUS Wed Mar 30 05:42:07 2022
@@ -56,13 +56,3 @@ Approved changes:
      1.14.x-r1881534-no-crlf
    Votes:
      +1: hartmannathan, stsp, markphip
-
- * r1892470, r1892471, r1892541
-   Fix an assertion failure triggered by the conflict resolver.
-   Justification:
-     Subversion should not crash. User complained.
-   Votes:
-     +1: stsp, markphip, rhuijben
-     +0: dsahlberg (test suite passes for 'check', 'davautocheck' and
-         'svnserveautocheck'. Not enough C experience for a formal
-         review)

Modified: subversion/branches/1.14.x/subversion/libsvn_client/conflicts.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.14.x/subversion/libsvn_client/conflicts.c?rev=1899377&r1=1899376&r2=1899377&view=diff
==============================================================================
--- subversion/branches/1.14.x/subversion/libsvn_client/conflicts.c (original)
+++ subversion/branches/1.14.x/subversion/libsvn_client/conflicts.c Wed Mar 30 05:42:07 2022
@@ -3014,12 +3014,12 @@ conflict_tree_get_details_local_missing(
                                                       deleted_basename,
                                                       conflict->pool);
   details->moves = moves;
+  details->wc_move_targets = apr_hash_make(conflict->pool);
   if (details->moves != NULL)
     {
       apr_pool_t *iterpool;
       int i;
 
-      details->wc_move_targets = apr_hash_make(conflict->pool);
       iterpool = svn_pool_create(scratch_pool);
       for (i = 0; i < details->moves->nelts; i++)
         {
@@ -8583,13 +8583,20 @@ resolve_incoming_move_file_text_merge(sv
        * Merge from the local move's target location to the
        * incoming move's target location. */
       struct conflict_tree_local_missing_details *local_details;
-      apr_array_header_t *moves;
 
       local_details = conflict->tree_conflict_local_details;
-      moves = svn_hash_gets(local_details->wc_move_targets,
-                            local_details->move_target_repos_relpath);
-      merge_source_abspath =
-        APR_ARRAY_IDX(moves, local_details->wc_move_target_idx, const char *);
+      if (local_details->wc_move_targets &&
+          local_details->move_target_repos_relpath)
+        {
+          apr_array_header_t *moves;
+          moves = svn_hash_gets(local_details->wc_move_targets,
+                                local_details->move_target_repos_relpath);
+          merge_source_abspath =
+            APR_ARRAY_IDX(moves, local_details->wc_move_target_idx,
+            const char *);
+        }
+      else
+        merge_source_abspath = victim_abspath;
     }
   else
     merge_source_abspath = victim_abspath;
@@ -9769,7 +9776,7 @@ resolve_local_move_dir_merge(svn_client_
             NULL, conflict, scratch_pool,
             scratch_pool));
 
-  if (details->wc_move_targets)
+  if (details->wc_move_targets && details->move_target_repos_relpath)
     {
       apr_array_header_t *moves;
 
@@ -10718,7 +10725,8 @@ describe_incoming_move_merge_conflict_op
           struct conflict_tree_incoming_delete_details *details;
 
           details = conflict->tree_conflict_incoming_details;
-          if (details->wc_move_targets)
+          if (details->wc_move_targets &&
+              details->move_target_repos_relpath)
             {
               apr_array_header_t *moves;
 
@@ -12251,7 +12259,7 @@ svn_client_conflict_option_get_moved_to_
 
       *possible_moved_to_abspaths = apr_array_make(result_pool, 1,
                                                    sizeof (const char *));
-      if (details->wc_move_targets)
+      if (details->wc_move_targets && details->move_target_repos_relpath)
         {
           apr_array_header_t *move_target_wc_abspaths;
           move_target_wc_abspaths =
@@ -12445,7 +12453,7 @@ svn_client_conflict_option_set_moved_to_
                 svn_dirent_skip_ancestor(wcroot_abspath, preferred_sibling),
                 scratch_pool));
         }
-      else if (details->wc_move_targets)
+      else if (details->wc_move_targets && details->move_target_repos_relpath)
        {
           apr_array_header_t *move_target_wc_abspaths;
           move_target_wc_abspaths =

Modified: subversion/branches/1.14.x/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.14.x/subversion/libsvn_wc/wc_db.c?rev=1899377&r1=1899376&r2=1899377&view=diff
==============================================================================
--- subversion/branches/1.14.x/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/branches/1.14.x/subversion/libsvn_wc/wc_db.c Wed Mar 30 05:42:07 2022
@@ -16644,7 +16644,7 @@ svn_wc__db_find_working_nodes_with_basen
   SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
             STMT_SELECT_PRESENT_HIGHEST_WORKING_NODES_BY_BASENAME_AND_KIND));
   SVN_ERR(svn_sqlite__bindf(stmt, "ist", wcroot->wc_id, basename,
-                            kind_map, kind));
+                            kind_map_none, kind));
   SVN_ERR(svn_sqlite__step(&have_row, stmt));
 
   *local_abspaths = apr_array_make(result_pool, 1, sizeof(const char *));
@@ -16688,7 +16688,7 @@ svn_wc__db_find_copies_of_repos_path(apr
   SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
             STMT_SELECT_COPIES_OF_REPOS_RELPATH));
   SVN_ERR(svn_sqlite__bindf(stmt, "ist", wcroot->wc_id, repos_relpath,
-                            kind_map, kind));
+                            kind_map_none, kind));
   SVN_ERR(svn_sqlite__step(&have_row, stmt));
 
   *local_abspaths = apr_array_make(result_pool, 1, sizeof(const char *));

Modified: subversion/branches/1.14.x/subversion/tests/cmdline/merge_tree_conflict_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/1.14.x/subversion/tests/cmdline/merge_tree_conflict_tests.py?rev=1899377&r1=1899376&r2=1899377&view=diff
==============================================================================
--- subversion/branches/1.14.x/subversion/tests/cmdline/merge_tree_conflict_tests.py (original)
+++ subversion/branches/1.14.x/subversion/tests/cmdline/merge_tree_conflict_tests.py Wed Mar 30 05:42:07 2022
@@ -2364,6 +2364,233 @@ def spurios_tree_conflict_with_added_fil
                                        [], False, True, '--reintegrate',
                                        sbox.ospath('A_branch'))
 
+def merge_local_missing_node_kind_none(sbox):
+  "crash in resolver triggered by none-type node"
+
+  sbox.build()
+  wc_dir = sbox.wc_dir
+
+  sbox.simple_mkdir('branches')
+  sbox.simple_commit() # r2
+  sbox.simple_update()
+
+  # Create a feature branch of A
+  sbox.simple_copy('A', 'branches/feature1')
+  sbox.simple_commit() #r3
+  sbox.simple_update()
+
+  # On the branch, move file alpha to another directory
+  sbox.simple_move('branches/feature1/B/E/alpha',
+                   'branches/feature1/D/H/alpha-from-B-E')
+  sbox.simple_commit() # r4
+  sbox.simple_update()
+
+  # Cherry-pick the delete-half of the above move into A (the trunk)
+  expected_output = svntest.wc.State(sbox.ospath('A/B/E'), {
+    'alpha'          : Item(status='D '),
+  })
+  expected_mergeinfo_output = wc.State(sbox.ospath('A/B/E'), {
+    ''                  : Item(status=' U')
+  })
+  expected_elision_output = wc.State(wc_dir, {
+  })
+  expected_disk = wc.State('', {
+    'beta'              : Item(contents="This is the file 'beta'.\n"),
+    '.'                 : Item(props={u'svn:mergeinfo':
+                                      u'/branches/feature1/B/E:4'}),
+  })
+  expected_status = wc.State(sbox.ospath('A/B/E'), {
+    ''                  : Item(status=' M', wc_rev='4'),
+    'alpha'             : Item(status='D ', wc_rev='4'),
+    'beta'              : Item(status='  ', wc_rev='4'),
+  })
+  expected_skip = wc.State('', {
+  })
+  svntest.actions.run_and_verify_merge(sbox.ospath('A/B/E'), 3, 4,
+                                       sbox.repo_url + '/branches/feature1/B/E',
+                                       None,
+                                       expected_output,
+                                       expected_mergeinfo_output,
+                                       expected_elision_output,
+                                       expected_disk,
+                                       expected_status,
+                                       expected_skip,
+                                       check_props=True)
+  sbox.simple_commit() # r5
+  sbox.simple_update()
+
+  # Create a new file on the feature branch
+  sbox.simple_add_text("This is the file 'pi'\n", 'branches/feature1/B/E/pi')
+  sbox.simple_commit() #r6
+  sbox.simple_update()
+
+  # Create a second branch based on the feature branch.
+  sbox.simple_copy('branches/feature1', 'branches/feature2')
+  sbox.simple_commit() #r7
+  sbox.simple_update()
+
+  # Create a new file kappa on this second branch
+  sbox.simple_add_text("This is the file 'kappa'\n",
+                       'branches/feature2/B/E/kappa')
+  sbox.simple_commit() #r8
+  sbox.simple_update()
+
+  # An unrelated additional change on the second branch.
+  sbox.simple_append('branches/feature2/B/E/beta',
+                     "This is a change to file 'beta'.\n")
+  sbox.simple_commit() #r9
+  sbox.simple_update()
+
+  # Merge the second branch back into the feature branch
+  expected_output = svntest.wc.State(sbox.ospath('branches/feature1'), {
+    'B/E/kappa'         : Item(status='A '),
+    'B/E/beta'          : Item(status='U '),
+    })
+  expected_mergeinfo_output = wc.State(sbox.ospath('branches/feature1'), {
+    '.'                 : Item(status=' U'),
+  })
+  expected_elision_output = wc.State(wc_dir, {
+  })
+  expected_disk = wc.State('', {
+    'C'                 : Item(),
+    'B/E/kappa'         : Item(contents="This is the file 'kappa'\n"),
+    'B/E/pi'            : Item(contents="This is the file 'pi'\n"),
+    'B/E/beta'          : Item(contents="This is the file 'beta'.\n" +
+                                        "This is a change to file 'beta'.\n"),
+    'B/lambda'          : Item(contents="This is the file 'lambda'.\n"),
+    'B/F'               : Item(),
+    'D/H/omega'         : Item(contents="This is the file 'omega'.\n"),
+    'D/H/alpha-from-B-E': Item(contents="This is the file 'alpha'.\n"),
+    'D/H/psi'           : Item(contents="This is the file 'psi'.\n"),
+    'D/H/chi'           : Item(contents="This is the file 'chi'.\n"),
+    'D/G/pi'            : Item(contents="This is the file 'pi'.\n"),
+    'D/G/rho'           : Item(contents="This is the file 'rho'.\n"),
+    'D/G/tau'           : Item(contents="This is the file 'tau'.\n"),
+    'D/gamma'           : Item(contents="This is the file 'gamma'.\n"),
+    'mu'                : Item(contents="This is the file 'mu'.\n"),
+    '.'                 : Item(props={u'svn:mergeinfo':
+                                      u'/branches/feature2:7-9'}),
+  })
+  expected_status = wc.State(sbox.ospath('branches/feature1'), {
+    ''                  : Item(status=' M', wc_rev='9'),
+    'mu'                : Item(status='  ', wc_rev='9'),
+    'D'                 : Item(status='  ', wc_rev='9'),
+    'D/H'               : Item(status='  ', wc_rev='9'),
+    'D/H/alpha-from-B-E': Item(status='  ', wc_rev='9'),
+    'D/H/psi'           : Item(status='  ', wc_rev='9'),
+    'D/H/chi'           : Item(status='  ', wc_rev='9'),
+    'D/H/omega'         : Item(status='  ', wc_rev='9'),
+    'D/G'               : Item(status='  ', wc_rev='9'),
+    'D/G/pi'            : Item(status='  ', wc_rev='9'),
+    'D/G/tau'           : Item(status='  ', wc_rev='9'),
+    'D/G/rho'           : Item(status='  ', wc_rev='9'),
+    'D/gamma'           : Item(status='  ', wc_rev='9'),
+    'B'                 : Item(status='  ', wc_rev='9'),
+    'B/E'               : Item(status='  ', wc_rev='9'),
+    'B/E/beta'          : Item(status='M ', wc_rev='9'),
+    'B/E/kappa'         : Item(status='A ', copied='+', wc_rev='-'),
+    'B/E/pi'            : Item(status='  ', wc_rev='9'),
+    'B/lambda'          : Item(status='  ', wc_rev='9'),
+    'B/F'               : Item(status='  ', wc_rev='9'),
+    'C'                 : Item(status='  ', wc_rev='9'),
+  })
+  expected_skip = wc.State('', {
+  })
+  svntest.actions.run_and_verify_merge(sbox.ospath('branches/feature1'),
+                                       None, None,
+                                       sbox.repo_url + '/branches/feature2',
+                                       None,
+                                       expected_output,
+                                       expected_mergeinfo_output,
+                                       expected_elision_output,
+                                       expected_disk,
+                                       expected_status,
+                                       expected_skip,
+                                       check_props=True)
+  sbox.simple_commit() # r10
+  sbox.simple_update()
+
+  # On the feature branch, rename the file kappa
+  sbox.simple_move('branches/feature1/B/E/kappa',
+                   'branches/feature1/B/E/kappanew')
+  sbox.simple_commit() # r11
+  sbox.simple_update()
+
+  # On the feature branch, move file kappanew to another directory
+  sbox.simple_move('branches/feature1/B/E/kappanew',
+                   'branches/feature1/D/H/kappanew')
+  sbox.simple_commit() # r12
+  sbox.simple_update()
+
+  # Cherry-pick r12 into A (the trunk)
+  # This triggers an assertion failure in Subversion 1.14.1 because of
+  # a node type lookup which uses the wrong token map:
+  # W: subversion/libsvn_subr/token.c:40: (apr_err=SVN_ERR_ASSERTION_FAIL)
+  # svn: E235000: In file 'subversion/libsvn_subr/token.c' line 40: internal malfunction
+  expected_output = svntest.wc.State(sbox.ospath('A'), {
+    'B/E/kappanew'      : Item(status='  ', treeconflict='C'),
+    'D/H/kappanew'      : Item(status='A '),
+  })
+  expected_mergeinfo_output = wc.State(sbox.ospath('A'), {
+    ''                 : Item(status=' U'),
+    'B/E'              : Item(status=' U'),
+  })
+  expected_elision_output = wc.State(wc_dir, {
+  })
+  expected_disk = wc.State('', {
+    'C'                 : Item(),
+    'B/E'               : Item(props={u'svn:mergeinfo':
+                                      u'/branches/feature1/B/E:4,12'}),
+    'B/E/beta'          : Item(contents="This is the file 'beta'.\n"),
+    'B/lambda'          : Item(contents="This is the file 'lambda'.\n"),
+    'B/F'               : Item(),
+    'D/H/omega'         : Item(contents="This is the file 'omega'.\n"),
+    'D/H/kappanew'      : Item(contents="This is the file 'kappa'\n"),
+    'D/H/psi'           : Item(contents="This is the file 'psi'.\n"),
+    'D/H/chi'           : Item(contents="This is the file 'chi'.\n"),
+    'D/G/pi'            : Item(contents="This is the file 'pi'.\n"),
+    'D/G/rho'           : Item(contents="This is the file 'rho'.\n"),
+    'D/G/tau'           : Item(contents="This is the file 'tau'.\n"),
+    'D/gamma'           : Item(contents="This is the file 'gamma'.\n"),
+    'mu'                : Item(contents="This is the file 'mu'.\n"),
+    '.'                 : Item(props={u'svn:mergeinfo':
+                                      u'/branches/feature1:12'}),
+  })
+  expected_status = wc.State(sbox.ospath('A'), {
+    ''                  : Item(status=' M', wc_rev='12'),
+    'D'                 : Item(status='  ', wc_rev='12'),
+    'D/H'               : Item(status='  ', wc_rev='12'),
+    'D/H/chi'           : Item(status='  ', wc_rev='12'),
+    'D/H/psi'           : Item(status='  ', wc_rev='12'),
+    'D/H/kappanew'      : Item(status='A ', copied='+', wc_rev='-'),
+    'D/H/omega'         : Item(status='  ', wc_rev='12'),
+    'D/G'               : Item(status='  ', wc_rev='12'),
+    'D/G/pi'            : Item(status='  ', wc_rev='12'),
+    'D/G/tau'           : Item(status='  ', wc_rev='12'),
+    'D/G/rho'           : Item(status='  ', wc_rev='12'),
+    'D/gamma'           : Item(status='  ', wc_rev='12'),
+    'B'                 : Item(status='  ', wc_rev='12'),
+    'B/E'               : Item(status=' M', wc_rev='12'),
+    'B/E/beta'          : Item(status='  ', wc_rev='12'),
+    'B/E/kappanew'      : Item(status='! ', treeconflict='C'),
+    'B/F'               : Item(status='  ', wc_rev='12'),
+    'B/lambda'          : Item(status='  ', wc_rev='12'),
+    'mu'                : Item(status='  ', wc_rev='12'),
+    'C'                 : Item(status='  ', wc_rev='12'),
+  })
+  expected_skip = wc.State('', {
+  })
+  svntest.actions.run_and_verify_merge(sbox.ospath('A'), 11, 12,
+                                       sbox.repo_url + '/branches/feature1',
+                                       None,
+                                       expected_output,
+                                       expected_mergeinfo_output,
+                                       expected_elision_output,
+                                       expected_disk,
+                                       expected_status,
+                                       expected_skip,
+                                       check_props=True)
+
 
 ########################################################################
 # Run the tests
@@ -2399,6 +2626,7 @@ test_list = [ None,
               merge_obstruction_recording,
               added_revision_recording_in_tree_conflict,
               spurios_tree_conflict_with_added_file,
+              merge_local_missing_node_kind_none,
              ]
 
 if __name__ == '__main__':