You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2015/09/10 11:42:58 UTC

svn commit: r1702198 - in /subversion/trunk/subversion: libsvn_wc/update_editor.c tests/cmdline/update_tests.py

Author: rhuijben
Date: Thu Sep 10 09:42:58 2015
New Revision: 1702198

URL: http://svn.apache.org/r1702198
Log:
Resolve an obscure segfault when updating inside an already conflicted tree.

Found by: TortoiseSVN dump
          ivan
(Reproduction recipe and patch by me)

* subversion/libsvn_wc/update_editor.c
  (add_directory,
   add_file): Don't calculate new repository paths inside a skipped tree.

* subversion/tests/cmdline/update_tests.py
  (update_add_conflicted_deep): New test.
  (test_list): Add test.

Modified:
    subversion/trunk/subversion/libsvn_wc/update_editor.c
    subversion/trunk/subversion/tests/cmdline/update_tests.py

Modified: subversion/trunk/subversion/libsvn_wc/update_editor.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/update_editor.c?rev=1702198&r1=1702197&r2=1702198&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/update_editor.c (original)
+++ subversion/trunk/subversion/libsvn_wc/update_editor.c Thu Sep 10 09:42:58 2015
@@ -1863,13 +1863,14 @@ add_directory(const char *path,
   SVN_ERR_ASSERT(! (copyfrom_path || SVN_IS_VALID_REVNUM(copyfrom_rev)));
 
   SVN_ERR(make_dir_baton(&db, path, eb, pb, TRUE, pool));
-  SVN_ERR(calculate_repos_relpath(&db->new_repos_relpath, db->local_abspath,
-                                  NULL, eb, pb, db->pool, scratch_pool));
   *child_baton = db;
 
   if (db->skip_this)
     return SVN_NO_ERROR;
 
+  SVN_ERR(calculate_repos_relpath(&db->new_repos_relpath, db->local_abspath,
+                                  NULL, eb, pb, db->pool, scratch_pool));
+
   SVN_ERR(mark_directory_edited(db, pool));
 
   if (strcmp(eb->target_abspath, db->local_abspath) == 0)
@@ -3066,13 +3067,13 @@ add_file(const char *path,
   SVN_ERR_ASSERT(! (copyfrom_path || SVN_IS_VALID_REVNUM(copyfrom_rev)));
 
   SVN_ERR(make_file_baton(&fb, pb, path, TRUE, pool));
-  SVN_ERR(calculate_repos_relpath(&fb->new_repos_relpath, fb->local_abspath,
-                                  NULL, eb, pb, fb->pool, pool));
   *file_baton = fb;
 
   if (fb->skip_this)
     return SVN_NO_ERROR;
 
+  SVN_ERR(calculate_repos_relpath(&fb->new_repos_relpath, fb->local_abspath,
+                                  NULL, eb, pb, fb->pool, pool));
   SVN_ERR(mark_file_edited(fb, pool));
 
   /* The file_pool can stick around for a *long* time, so we want to

Modified: subversion/trunk/subversion/tests/cmdline/update_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/update_tests.py?rev=1702198&r1=1702197&r2=1702198&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/update_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/update_tests.py Thu Sep 10 09:42:58 2015
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python
 #
 #  update_tests.py:  testing update cases.
 #
@@ -6731,6 +6731,32 @@ def update_keywords_on_shortcut(sbox):
               for line in text_after_up]):
     raise svntest.Failure("update did not update the LastChangedRevision keyword")
 
+def update_add_conflicted_deep(sbox):
+  "deep add conflicted"
+
+  sbox.build()
+  repo_url = sbox.repo_url
+
+  svntest.actions.run_and_verify_svnmucc(
+                        None, [], '-U', repo_url, '-m', '',
+                        'mkdir', 'A/z',
+                        'mkdir', 'A/z/z',
+                        'mkdir', 'A/z/z/z')
+
+  svntest.actions.run_and_verify_svnmucc(
+                        None, [], '-U', repo_url, '-m', '',
+                        'rm', 'A/z',
+                        'mkdir', 'A/z',
+                        'mkdir', 'A/z/z',
+                        'mkdir', 'A/z/z/z')
+
+  sbox.simple_append('A/z', 'A/z')
+  sbox.simple_add('A/z')
+  sbox.simple_update('A', 2)
+  # This final update used to segfault using 1.9.0 and 1.9.1
+  sbox.simple_update('A/z/z', 3)
+
+
 #######################################################################
 # Run the tests
 
@@ -6818,6 +6844,7 @@ test_list = [ None,
               update_child_below_add,
               update_conflict_details,
               update_keywords_on_shortcut,
+              update_add_conflicted_deep,
              ]
 
 if __name__ == '__main__':