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

[PATCH] Prevent the modification of the URL [was 1.0.1 veto for r8959]

From: makl <makl_at_tigris.org>
Date: 2004-03-13 11:46:45 CET

Philip Martin wrote:
> A failed switch to the non-existant URL modifies the working copy:
>
> $ svnadmin create repo
> $ svn co file://`pwd`/repo wc
> $ svn sw file://`pwd`/repo/foo wc
> ../svn/subversion/libsvn_repos/reporter.c:845: (apr_err=160005)
> svn: Cannot replace a directory from within
> $ svn info wc | grep URL
> URL: file:///home/pm/sw/subversion/obj/repo/foo

This patch guarantees that the parameters of delta_dirs are checked
*before* open_root is called.

It is an addition to the patch from John Szakmeister to ensure that this
problem can't occur with other functions too.

[[[
Fix unintended modification of directory entry.

Patch from <makl@tigris.org>

* subversion/libsvn_repos/reporter.c
      (drive): Check the parameters of delta_dirs before open_root is
      called.
]]]

Index: subversion/libsvn_repos/reporter.c
===================================================================
--- subversion/libsvn_repos/reporter.c (revision 9011)
+++ subversion/libsvn_repos/reporter.c (working copy)
@@ -835,15 +835,21 @@
   if (info_is_set_path && !s_entry)
     s_fullpath = NULL;
 
- SVN_ERR (b->editor->open_root (b->edit_baton, s_rev, pool, &root_baton));
-
+ /* Do the error checking before calling open_root, since open_root may
+ modify the entry for the dir. */
   if (!*b->s_operand)
     {
- /* The wc anchor is the operand, so just diff the two directories. */
       if (!s_entry || s_entry->kind != svn_node_dir
           || !t_entry || t_entry->kind != svn_node_dir)
         return svn_error_create (SVN_ERR_FS_PATH_SYNTAX, NULL,
                                  "Cannot replace a directory from within");
+ }
+
+ SVN_ERR (b->editor->open_root (b->edit_baton, s_rev, pool, &root_baton));
+
+ if (!*b->s_operand)
+ {
+ /* The wc anchor is the operand, so just diff the two directories. */
       SVN_ERR (delta_dirs (b, s_rev, s_fullpath, b->t_path, root_baton,
                            "", info->start_empty, pool));
     }

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Mar 13 11:44:59 2004

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.