You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2010/11/03 19:11:31 UTC

svn commit: r1030580 - in /subversion/trunk/subversion: libsvn_client/resolved.c svn/resolve-cmd.c tests/cmdline/input_validation_tests.py

Author: stsp
Date: Wed Nov  3 18:11:31 2010
New Revision: 1030580

URL: http://svn.apache.org/viewvc?rev=1030580&view=rev
Log:
Make 'svn resolve' verify that none of its targets are URLs.

* subversion/libsvn_client/resolved.c,
  subversion/svn/resolve-cmd.c
  (svn_client_resolve, svn_cl__resolve): Raise an error if any targets
  look like URLs.

* subversion/tests/cmdline/input_validation_tests.py
  (invalid_resolve_targets, test_list): New test.

Patch by: Noorul Islam K M <noorul{_AT_}collab.net>

Modified:
    subversion/trunk/subversion/libsvn_client/resolved.c
    subversion/trunk/subversion/svn/resolve-cmd.c
    subversion/trunk/subversion/tests/cmdline/input_validation_tests.py

Modified: subversion/trunk/subversion/libsvn_client/resolved.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/resolved.c?rev=1030580&r1=1030579&r2=1030580&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/resolved.c (original)
+++ subversion/trunk/subversion/libsvn_client/resolved.c Wed Nov  3 18:11:31 2010
@@ -36,6 +36,7 @@
 #include "client.h"
 #include "private/svn_wc_private.h"
 
+#include "svn_private_config.h"
 
 /*** Code. ***/
 
@@ -48,6 +49,11 @@ svn_client_resolve(const char *path,
 {
   const char *local_abspath;
 
+  if (svn_path_is_url(path))
+    return svn_error_return(svn_error_createf(SVN_ERR_ILLEGAL_TARGET, NULL,
+                                              _("'%s' is not a local path"),
+                                              path));
+
   SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, pool));
 
   SVN_ERR(svn_wc_resolved_conflict5(ctx->wc_ctx, local_abspath,

Modified: subversion/trunk/subversion/svn/resolve-cmd.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/resolve-cmd.c?rev=1030580&r1=1030579&r2=1030580&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/resolve-cmd.c (original)
+++ subversion/trunk/subversion/svn/resolve-cmd.c Wed Nov  3 18:11:31 2010
@@ -29,6 +29,7 @@
 #define APR_WANT_STDIO
 #include <apr_want.h>
 
+#include "svn_path.h"
 #include "svn_client.h"
 #include "svn_error.h"
 #include "svn_pools.h"
@@ -93,6 +94,19 @@ svn_cl__resolve(apr_getopt_t *os,
 
   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++)
     {

Modified: subversion/trunk/subversion/tests/cmdline/input_validation_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/input_validation_tests.py?rev=1030580&r1=1030579&r2=1030580&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/input_validation_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/input_validation_tests.py Wed Nov  3 18:11:31 2010
@@ -173,6 +173,12 @@ def invalid_wcpath_upgrade(sbox):
     run_and_verify_svn_in_wc(sbox, "svn:.*is not a local path", 'upgrade',
                              target, target)
 
+def invalid_resolve_targets(sbox):
+  "non-working copy paths for 'resolve'"
+  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", 'resolve',
+                             '--accept', 'base', target)
 
 ########################################################################
 # Run the tests
@@ -192,6 +198,7 @@ test_list = [ None,
               invalid_log_targets,
               invalid_merge_args,
               invalid_wcpath_upgrade,
+              invalid_resolve_targets,
              ]
 
 if __name__ == '__main__':