All pastes #1021930 Raw Edit

kfogel

public text v1 · immutable
#1021930 ·published 2008-05-18 15:25 UTC
rendered paste body
[[[
* subversion/tests/cmdline/copy_tests.py
  (unneeded_parents): New test.
  (test_list): Run it.
]]]

Index: subversion/tests/cmdline/copy_tests.py
===================================================================
--- subversion/tests/cmdline/copy_tests.py	(revision 31288)
+++ subversion/tests/cmdline/copy_tests.py	(working copy)
@@ -3819,6 +3819,57 @@
     svntest.main.safe_rmtree(other_wc_dir)
 
 
+def unneeded_parents(sbox):
+  "svn cp --parents FILE_URL DIR_URL"
+
+  # In this message...
+  #
+  #    http://subversion.tigris.org/servlets/ReadMsg?list=dev&msgNo=138738
+  #    From: Alexander Kitaev <Alexander.Kitaev@svnkit.com>
+  #    To: dev@subversion.tigris.org
+  #    Subject: 1.5.x segmentation fault on Repos to Repos copy
+  #    Message-ID: <4830332A.6060301@svnkit.com>
+  #    Date: Sun, 18 May 2008 15:46:18 +0200
+  #
+  # ...Alexander Kitaev describes the bug:
+  #
+  #    svn cp --parents SRC_FILE_URL DST_DIR_URL -m "message"
+  #
+  #    SRC_FILE_URL - existing file
+  #    DST_DIR_URL - existing directory
+  # 
+  #    Omitting "--parents" option makes above copy operation work as
+  #    expected.
+  # 
+  #    Bug is in libsvn_client/copy.c:801, where "dir" should be
+  #    checked for null before using it in svn_ra_check_path call.
+  
+  sbox.build()
+  wc_dir = sbox.wc_dir
+
+  iota_url = sbox.repo_url + '/iota'
+  B_url = sbox.repo_url + '/A/B/'
+
+  # The --parents is unnecessary, but should still work (not segfault).
+  svntest.actions.run_and_verify_svn(None, None, [], 'cp', '--parents',
+                                     '-m', 'log msg', iota_url, B_url)
+
+  # Verify that it worked.
+  expected_output = svntest.wc.State(wc_dir, {
+    'A/B/iota' : Item(status='A '),
+    })
+  expected_disk = svntest.main.greek_state.copy()
+  expected_disk.add({
+    'A/B/iota'  : Item(contents="This is the file 'iota'.\n"),
+    })
+  expected_status = svntest.actions.get_virginal_state(wc_dir, 2)
+  expected_status.add({
+    'A/B/iota'  : Item(status='  ', wc_rev=2),
+    })
+  svntest.actions.run_and_verify_update(
+    wc_dir, expected_output, expected_disk, expected_status)
+
+
 ########################################################################
 # Run the tests
 
@@ -3895,6 +3946,7 @@
               URI_encoded_repos_to_wc,
               allow_unversioned_parent_for_copy_src,
               replaced_local_source_for_incoming_copy,
+              unneeded_parents,
              ]
 
 if __name__ == '__main__':