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

r12365: URL canonicalisation bug in "checkout"

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: 2005-09-03 13:56:12 CEST

I'm not sure when URLs are supposed to be canonicalised, but there was
definitely a bug or at least a code redundancy introduced by this revision.

> Index: subversion/libsvn_client/checkout.c
> ===================================================================
> --- subversion/libsvn_client/checkout.c (revision 12364)
> +++ subversion/libsvn_client/checkout.c (revision 12365)
> @@ -42,8 +42,9 @@
>
> svn_error_t *
> svn_client__checkout_internal (svn_revnum_t *result_rev,
> - const char *URL,
> + const char *url,
> const char *path,
> + const svn_opt_revision_t *peg_revision,
> const svn_opt_revision_t *revision,
> svn_boolean_t recurse,
> svn_boolean_t *timestamp_sleep,
> @@ -55,6 +56,7 @@
> svn_revnum_t revnum;
> svn_boolean_t sleep_here = FALSE;
> svn_boolean_t *use_sleep = timestamp_sleep ? timestamp_sleep : &sleep_here;
> + const char *URL;
>
> /* Sanity check. Without these, the checkout is meaningless. */
> assert (path != NULL);
> @@ -67,27 +69,19 @@
> return svn_error_create (SVN_ERR_CLIENT_BAD_REVISION, NULL, NULL);
>
> /* Canonicalize the URL. */
> - URL = svn_path_canonicalize (URL, pool);
> + URL = svn_path_canonicalize (url, pool);

This canonicalisation is now lost ...

>
> {
> - void *ra_baton, *session;
> + void *session;
> svn_ra_plugin_t *ra_lib;
> svn_node_kind_t kind;
> const char *uuid;
>
> - /* Get the RA vtable that matches URL. */
> - SVN_ERR (svn_ra_init_ra_libs (&ra_baton, pool));
> - SVN_ERR (svn_ra_get_ra_library (&ra_lib, ra_baton, URL, pool));
> -
> - /* Open an RA session to URL. Note that we do not have an admin area
> - for storing temp files. */
> - SVN_ERR (svn_client__open_ra_session (&session, ra_lib, URL, NULL,
> - NULL, NULL, FALSE, TRUE,
> - ctx, pool));
> -
> - SVN_ERR (svn_client__get_revision_number
> - (&revnum, ra_lib, session, revision, path, pool));
> -
> + /* Get the RA connection. */
> + SVN_ERR (svn_client__ra_lib_from_path (&ra_lib, &session, &revnum,
> + &URL, url, peg_revision,

... because here you're using "url" as input, and overwriting the canonicalised
"URL" with a new value without using it.

So, is that canonicalisation still wanted?

> + revision, ctx, pool));
> +
> SVN_ERR (ra_lib->check_path (session, "", revnum, &kind, pool));
> if (kind == svn_node_none)
> return svn_error_createf (SVN_ERR_RA_ILLEGAL_URL, NULL,
> @@ -192,6 +186,20 @@
> }

> ------------------------------------------------------------------------
> r12365 | jpieper | 2004-12-18 11:57:45 +0000 (Sat, 18 Dec 2004) | 42 lines
>
> Make the checkout subcommand accept peg revisions and follow history.
> Update the test suite so that tests which refer to past revisions do
> not rely on the default value of the peg revision in order to pass.
>
[...]
> * subversion/libsvn_client/checkout.c
> (svn_client__checkout_internal): Accept a peg revision parameter and
> use svn_client__ra_lib_from_path to get the RA connection.
> (svn_client_checkout2): New, implement.
> (svn_client_checkout): Implement in terms of svn_client_checkout2.

Minor point: the log message is inaccurate. Actually, svn_client_checkout()
was just modified to use the modified svn_client__checkout_internal(), not
implemented in terms of svn_client_checkout2().

> svn_client_checkout (svn_revnum_t *result_rev,
> const char *URL,
> const char *path,
> @@ -200,6 +208,10 @@
> svn_client_ctx_t *ctx,
> apr_pool_t *pool)
> {
> - return svn_client__checkout_internal (result_rev, URL, path,
> + svn_opt_revision_t peg_revision;
> +
> + peg_revision.kind = svn_opt_revision_unspecified;
> +
> + return svn_client__checkout_internal (result_rev, URL, path, &peg_revision,
> revision, recurse, NULL, ctx, pool);
> }

- Julian

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Sep 3 13:57:03 2005

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.