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

[PATCH] issue 3620: svn add ^/ triggers assertion failure

From: Uwe Stuehler <uwe_at_bsdx.de>
Date: Thu, 16 Sep 2010 14:59:35 +0200

This patch adds to the input validation tests a new case to verify that
"svn upgrade" rejects URL arguments (instead of crashing) and changes the
svn_cl__upgrade() routine to make it so. The change in svn_cl__upgrade()
is directly based on Stefan's change to svn_cl__add() in r965551.

I've started with the last command in the list output by "svn help" to avoid
colliding with Stefan's work (he is going forward from the top).

Cheers,
Uwe

[[[
Follow-up to r965551 on issue #3620: svn add ^/ triggers assertion failure

* subversion/svn/upgrade-cmd.c
  (svn_cl__upgrade): Check that target arguments aren't URLs before upgrading.

* subversion/tests/cmdline/input_validation_tests.py: New test for "upgrade".
]]]

Index: subversion/svn/upgrade-cmd.c
===================================================================
--- subversion/svn/upgrade-cmd.c (revision 997228)
+++ subversion/svn/upgrade-cmd.c (working copy)
@@ -31,6 +31,7 @@
 #include "svn_client.h"
 #include "svn_error_codes.h"
 #include "svn_error.h"
+#include "svn_path.h"
 #include "cl.h"
 #include "svn_private_config.h"

@@ -59,6 +60,19 @@

   SVN_ERR(svn_cl__eat_peg_revisions(&targets, targets, scratch_pool));

+ /* Don't even attempt to modify the working copy if any of the
+ * targets look like URLs. URLs are invalid input. */
+ for (i = 0; i < targets->nelts; i++)
+ {
+ const char *target = APR_ARRAY_IDX(targets, i, const char *);
+
+ if (svn_path_is_url(target))
+ return svn_error_return(svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR,
+ NULL,
+ _("'%s' is not a
local path"),
+ target));
+ }
+
   iterpool = svn_pool_create(scratch_pool);
   for (i = 0; i < targets->nelts; i++)
     {
Index: subversion/tests/cmdline/input_validation_tests.py
===================================================================
--- subversion/tests/cmdline/input_validation_tests.py (revision 997228)
+++ subversion/tests/cmdline/input_validation_tests.py (working copy)
@@ -166,7 +166,14 @@
   run_and_verify_svn_in_wc(sbox, "svn: Path '.*' does not exist",
                            'merge', '-c42', '^/mu', 'nonexistent')

+def invalid_wcpath_upgrade(sbox):
+ "non-working copy paths for 'upgrade'"
+ sbox.build(read_only=True)
+ for target in _invalid_wc_path_targets:
+ run_and_verify_svn_in_wc(sbox, "svn:.*is not a local path", 'upgrade',
+ target, target)

+
 ########################################################################
 # Run the tests

@@ -184,6 +191,7 @@
               invalid_import_args,
               invalid_log_targets,
               invalid_merge_args,
+ invalid_wcpath_upgrade,
              ]

 if __name__ == '__main__':
Received on 2010-09-16 15:09:58 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.