Author: stsp
Date: Fri Aug 20 12:39:20 2021
New Revision: 1892471

URL: http://svn.apache.org/viewvc?rev=1892471&view=rev
Log:
Fix an assertion failure triggered by the conflict resolver.

The resolver may need to deal with nodes of type 'none' but was using
a token map which does not support the 'none' type. Switch to a token
map which supports the 'none' type. This makes the regression test
added in r1892470 pass.

The above fix uncovered a different problem where the wc_move_targets
pointer in conflict details for a "local missing" node was left as NULL.
The assumption throughout the resolver is that this variable is initialized
to an empty array instead. Do this to avoid a NULL-deref which would
otherwise be triggered by the same regression test.

* subversion/libsvn_client/conflicts.c
  (conflict_tree_get_details_local_missing): Always initialize the
    details->wc_move_targets variable.

* subversion/libsvn_wc/wc_db.c
  (svn_wc__db_find_working_nodes_with_basename,
   svn_wc__db_find_copies_of_repos_path): Use kind_map_none instead of
    the regular kind_map which doesn't support the 'none' type.

* subversion/tests/cmdline/merge_tree_conflict_tests.py
  (merge_local_missing_node_kind_none): Remove XFail marker.

Reported by: Joshua Kordani (jkordani {AT} roboticresearch dot com)

Modified:
    subversion/trunk/subversion/libsvn_client/conflicts.c
    subversion/trunk/subversion/libsvn_wc/wc_db.c
    subversion/trunk/subversion/tests/cmdline/merge_tree_conflict_tests.py

Modified: subversion/trunk/subversion/libsvn_client/conflicts.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/conflicts.c?rev=1892471&r1=1892470&r2=1892471&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/conflicts.c (original)
+++ subversion/trunk/subversion/libsvn_client/conflicts.c Fri Aug 20 12:39:20 
2021
@@ -3028,12 +3028,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++)
         {

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1892471&r1=1892470&r2=1892471&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Fri Aug 20 12:39:20 2021
@@ -16732,7 +16732,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 *));
@@ -16776,7 +16776,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/trunk/subversion/tests/cmdline/merge_tree_conflict_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/merge_tree_conflict_tests.py?rev=1892471&r1=1892470&r2=1892471&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/merge_tree_conflict_tests.py 
(original)
+++ subversion/trunk/subversion/tests/cmdline/merge_tree_conflict_tests.py Fri 
Aug 20 12:39:20 2021
@@ -2364,7 +2364,6 @@ def spurios_tree_conflict_with_added_fil
                                        [], False, True, '--reintegrate',
                                        sbox.ospath('A_branch'))
 
-@XFail()
 def merge_local_missing_node_kind_none(sbox):
   "crash in resolver triggered by none-type node"
 


Reply via email to