[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r32467 - trunk/subversion/libsvn_wc

From: Daniel Shahaf <d.s_at_daniel.shahaf.name>
Date: Thu, 14 Aug 2008 14:49:47 +0300 (Jerusalem Daylight Time)

firemeteor_at_tigris.org wrote on Thu, 14 Aug 2008 at 02:44 -0700:
> Author: firemeteor
> Date: Thu Aug 14 02:44:52 2008
> New Revision: 32467
>
> Log:
> Fix working copy corruption which happens when copying a file
> into a directory that exists in the entries file of its parent,
> but is not physically present on disk.

I've taken a stab at regression test for this (hope you don't mind).
Does it look right to you?

Index: subversion/tests/cmdline/copy_tests.py
===================================================================
--- subversion/tests/cmdline/copy_tests.py (revision 32469)
+++ subversion/tests/cmdline/copy_tests.py (working copy)
@@ -3914,7 +3914,34 @@ def double_parents_with_url(sbox):
     wc_dir, expected_output, expected_disk, expected_status)
 
 
+# Used to cause corruption not fixable by 'svn cleanup'.
+def copy_into_absent_dir(sbox):
+ "copy file into absent dir"
 
+ sbox.build(read_only = True)
+ wc_dir = sbox.wc_dir
+
+ A_path = os.path.join(wc_dir, 'A')
+ iota_path = os.path.join(wc_dir, 'iota')
+
+ # Remove 'A'
+ svntest.main.safe_rmtree(A_path)
+
+ # Copy into the now-missing dir. This used to give this error:
+ # svn: In directory '.'
+ # svn: Error processing command 'modify-entry' in '.'
+ # svn: Error modifying entry for 'A'
+ # svn: Entry 'A' is already under version control
+ svntest.actions.run_and_verify_svn(None,
+ None, ".*: Path '.*' is not a directory",
+ 'cp', iota_path, A_path)
+
+ # 'cleanup' should not error.
+ svntest.actions.run_and_verify_svn(None, None, [],
+ 'cleanup', wc_dir)
+
+
+
 ########################################################################
 # Run the tests
 
@@ -3993,6 +4020,7 @@ test_list = [ None,
               replaced_local_source_for_incoming_copy,
               unneeded_parents,
               double_parents_with_url,
+ copy_into_absent_dir,
              ]
 
 if __name__ == '__main__':

Daniel

> This can happen when
> users remove a directory from the working copy without telling
> Subversion about it.
>
> The case where the destination is a file was already covered by
> the existing code. This commit extends the check to consider
> directories, too.
>
> See this thread for details:
> http://subversion.tigris.org/servlets/ReadMsg?list=dev&msgNo=141707
> Date: Sun, 6 Jul 2008 00:39:43 +0800
> From: "Rui, Guo" <timmyguo-fOMaevN1BEbsJZF79Ady7g_at_public.gmane.org>
> To: subversion development <dev-lmwclWVctOZK/UuDQWWi7iCwEArCW2h5_at_public.gmane.org>
> Message-ID: <20080705163943.GD8838-p05mYGMN5VqHZ67s3I6d56XFnHfyFoKT_at_public.gmane.org>
>
> * subversion/libsvn_wc/copy.c
> (copy_file_administratively): When checking whether the destination
> already exists, dst_basename may be a directory. Catch that case, too.
>
> Approved by: stsp
>
> Modified:
> trunk/subversion/libsvn_wc/copy.c
>
> Modified: trunk/subversion/libsvn_wc/copy.c
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_wc/copy.c?pathrev=32467&r1=32466&r2=32467
> ==============================================================================
> --- trunk/subversion/libsvn_wc/copy.c Wed Aug 13 19:18:24 2008 (r32466)
> +++ trunk/subversion/libsvn_wc/copy.c Thu Aug 14 02:44:52 2008 (r32467)
> @@ -447,14 +447,13 @@ copy_file_administratively(const char *s
> _("'%s' already exists and is in the way"),
> svn_path_local_style(dst_path, pool));
>
> - /* Even if DST_PATH doesn't exist it may still be a versioned file; it
> + /* Even if DST_PATH doesn't exist it may still be a versioned item; it
> may be scheduled for deletion, or the user may simply have removed the
> working copy. Since we are going to write to DST_PATH text-base and
> prop-base we need to detect such cases and abort. */
> SVN_ERR(svn_wc_entry(&dst_entry, dst_path, dst_parent, FALSE, pool));
> - if (dst_entry && dst_entry->kind == svn_node_file)
> + if (dst_entry && dst_entry->schedule != svn_wc_schedule_delete)
> {
> - if (dst_entry->schedule != svn_wc_schedule_delete)
> return svn_error_createf(SVN_ERR_ENTRY_EXISTS, NULL,
> _("There is already a versioned item '%s'"),
> svn_path_local_style(dst_path, pool));

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-08-14 13:50:07 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.