You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ko...@apache.org on 2015/09/12 00:55:26 UTC

svn commit: r1702565 - in /subversion/trunk/subversion: libsvn_client/merge.c tests/cmdline/merge_automatic_tests.py

Author: kotkov
Date: Fri Sep 11 22:55:26 2015
New Revision: 1702565

URL: http://svn.apache.org/r1702565
Log:
Following up on r1702397, also avoid a segfault for --reintegrate merging
to a local addition.

* subversion/libsvn_client/merge.c
  (open_reintegrate_source_and_target): Check if TARGET->LOC.URL is null
   before attempting to open the RA session for it, as doing so would
   dereference the null pointer.

* subversion/tests/cmdline/merge_automatic_tests.py
  (merge_to_copy_and_add): Extend the test with another check that segfaults
   without this fix.

Modified:
    subversion/trunk/subversion/libsvn_client/merge.c
    subversion/trunk/subversion/tests/cmdline/merge_automatic_tests.py

Modified: subversion/trunk/subversion/libsvn_client/merge.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/merge.c?rev=1702565&r1=1702564&r2=1702565&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/merge.c (original)
+++ subversion/trunk/subversion/libsvn_client/merge.c Fri Sep 11 22:55:26 2015
@@ -11636,9 +11636,6 @@ open_reintegrate_source_and_target(svn_r
   SVN_ERR(open_target_wc(&target, target_abspath,
                          FALSE, FALSE, FALSE,
                          ctx, scratch_pool, scratch_pool));
-  SVN_ERR(svn_client_open_ra_session2(target_ra_session_p,
-                                      target->loc.url, target->abspath,
-                                      ctx, result_pool, scratch_pool));
   if (! target->loc.url)
     return svn_error_createf(SVN_ERR_CLIENT_UNRELATED_RESOURCES, NULL,
                              _("Can't reintegrate into '%s' because it is "
@@ -11647,6 +11644,10 @@ open_reintegrate_source_and_target(svn_r
                              svn_dirent_local_style(target->abspath,
                                                     scratch_pool));
 
+  SVN_ERR(svn_client_open_ra_session2(target_ra_session_p,
+                                      target->loc.url, target->abspath,
+                                      ctx, result_pool, scratch_pool));
+
   SVN_ERR(svn_client__ra_session_from_path2(
             source_ra_session_p, &source_loc,
             source_path_or_url, NULL, source_peg_revision, source_peg_revision,

Modified: subversion/trunk/subversion/tests/cmdline/merge_automatic_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/merge_automatic_tests.py?rev=1702565&r1=1702564&r2=1702565&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/merge_automatic_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/merge_automatic_tests.py Fri Sep 11 22:55:26 2015
@@ -1346,6 +1346,11 @@ def merge_to_copy_and_add(sbox):
   expected_err = ".*svn: E195012: Can't perform .*A3'.*added.*"
   svntest.actions.run_and_verify_svn(None, expected_err,
                                      'merge', '^/A', sbox.ospath('A3'))
+  # Try the same merge with --reintegrate, for completeness' sake.
+  expected_err = ".*svn: E195012: Can't reintegrate into .*A3'.*added.*"
+  svntest.actions.run_and_verify_svn(None, expected_err,
+                                     'merge', '--reintegrate', '^/A',
+                                     sbox.ospath('A3'))
 
 ########################################################################
 # Run the tests