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/08/03 17:50:14 UTC
svn commit: r981942 - in /subversion/trunk/subversion:
libsvn_client/cmdline.c libsvn_client/log.c svn/log-cmd.c
tests/cmdline/input_validation_tests.py
Author: stsp
Date: Tue Aug 3 15:50:14 2010
New Revision: 981942
URL: http://svn.apache.org/viewvc?rev=981942&view=rev
Log:
* subversion/libsvn_client/log.c,
subversion/svn/log-cmd.c
(svn_client_log5, svn_cl__log): Reject URLs and absolute paths following
an initial URL target. Fixes a user-triggerable assertion.
* subversion/libsvn_client/cmdline.c
(check_root_url_of_target): Don't error out if the target itself is a
URL to a non-existent repository (for instance "svn: Unable to open
repository 'file://'"). This allows higher layers to deal with the
argument appropriately, once the semantic context of the argument
is fully known. Erroring out here is too early, because the sub-command
didn't even get to take a look at any of the arguments yet.
* subversion/tests/cmdline/input_validation_tests.py
(invalid_log_targets, test_list): New test.
Modified:
subversion/trunk/subversion/libsvn_client/cmdline.c
subversion/trunk/subversion/libsvn_client/log.c
subversion/trunk/subversion/svn/log-cmd.c
subversion/trunk/subversion/tests/cmdline/input_validation_tests.py
Modified: subversion/trunk/subversion/libsvn_client/cmdline.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/cmdline.c?rev=981942&r1=981941&r2=981942&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/cmdline.c (original)
+++ subversion/trunk/subversion/libsvn_client/cmdline.c Tue Aug 3 15:50:14 2010
@@ -121,10 +121,15 @@ check_root_url_of_target(const char **ro
/* It is OK if the given target does not exist, it just means
* we will not be able to determine the root url from this particular
* argument.
+ *
+ * If the target itself is a URL to a repository that does not exist,
+ * that's fine, too. The callers will deal with this argument in an
+ * appropriate manter if it does not make any sense.
*/
if ((err->apr_err == SVN_ERR_ENTRY_NOT_FOUND)
|| (err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND)
- || (err->apr_err == SVN_ERR_WC_NOT_WORKING_COPY))
+ || (err->apr_err == SVN_ERR_WC_NOT_WORKING_COPY)
+ || (err->apr_err == SVN_ERR_RA_LOCAL_REPOS_OPEN_FAILED))
{
svn_error_clear(err);
return SVN_NO_ERROR;
Modified: subversion/trunk/subversion/libsvn_client/log.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/log.c?rev=981942&r1=981941&r2=981942&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/log.c (original)
+++ subversion/trunk/subversion/libsvn_client/log.c Tue Aug 3 15:50:14 2010
@@ -391,8 +391,17 @@ svn_client_log5(const apr_array_header_t
{
/* We have some paths, let's use them. Start after the URL. */
for (i = 1; i < targets->nelts; i++)
- APR_ARRAY_PUSH(condensed_targets, const char *) =
- APR_ARRAY_IDX(targets, i, const char *);
+ {
+ const char *target;
+
+ target = APR_ARRAY_IDX(targets, i, const char *);
+ if (svn_path_is_url(target) || svn_dirent_is_absolute(target))
+ return svn_error_return(svn_error_createf(
+ SVN_ERR_ILLEGAL_TARGET, NULL,
+ _("'%s' is not a relative path"),
+ target));
+ APR_ARRAY_PUSH(condensed_targets, const char *) = target;
+ }
}
else
{
Modified: subversion/trunk/subversion/svn/log-cmd.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/log-cmd.c?rev=981942&r1=981941&r2=981942&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/log-cmd.c (original)
+++ subversion/trunk/subversion/svn/log-cmd.c Tue Aug 3 15:50:14 2010
@@ -27,6 +27,7 @@
#include "svn_client.h"
#include "svn_compat.h"
+#include "svn_dirent_uri.h"
#include "svn_string.h"
#include "svn_path.h"
#include "svn_error.h"
@@ -647,10 +648,13 @@ svn_cl__log(apr_getopt_t *os,
{
target = APR_ARRAY_IDX(targets, i, const char *);
- if (svn_path_is_url(target))
- return svn_error_create(SVN_ERR_UNSUPPORTED_FEATURE, NULL,
- _("Only relative paths can be specified "
- "after a URL"));
+ if (svn_path_is_url(target) || svn_dirent_is_absolute(target))
+ return svn_error_return(svn_error_createf(
+ SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("Only relative paths can be specified"
+ " after a URL for 'svn log', "
+ "but '%s' is not a relative path"),
+ target));
}
}
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=981942&r1=981941&r2=981942&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/input_validation_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/input_validation_tests.py Tue Aug 3 15:50:14 2010
@@ -141,6 +141,14 @@ def invalid_import_args(sbox):
run_and_verify_svn_in_wc(sbox, "svn: Invalid URL 'iota'",
'import', 'iota', 'iota')
+def invalid_log_targets(sbox):
+ "invalid targets for 'log'"
+ sbox.build(read_only=True)
+ for (target1, target2) in [('^/', '/a/b/c'), ('^/', '^/'), ('^/', 'file://')]:
+ run_and_verify_svn_in_wc(sbox, "svn: Only relative paths can be " +
+ "specified after a URL for 'svn log', but.*is " +
+ "not a relative path", 'log', target1, target2)
+
########################################################################
# Run the tests
@@ -156,6 +164,7 @@ test_list = [ None,
invalid_diff_targets,
invalid_export_targets,
invalid_import_args,
+ invalid_log_targets,
]
if __name__ == '__main__':