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

RE: svn commit: r1723385 - in /subversion/trunk/subversion: libsvn_client/relocate.c tests/cmdline/relocate_tests.py

From: Bert Huijben <bert_at_qqmail.nl>
Date: Wed, 6 Jan 2016 18:43:01 +0100

> -----Original Message-----
> From: philip_at_apache.org [mailto:philip_at_apache.org]
> Sent: woensdag 6 januari 2016 18:20
> To: commits_at_subversion.apache.org
> Subject: svn commit: r1723385 - in /subversion/trunk/subversion:
> libsvn_client/relocate.c tests/cmdline/relocate_tests.py
>
> Author: philip
> Date: Wed Jan 6 17:20:28 2016
> New Revision: 1723385
>
> URL: http://svn.apache.org/viewvc?rev=1723385&view=rev
> Log:
> Fix a problem relocating some externals.
>
> Reported by: Larry Baird <lab{_AT_}gta.com>
>
> * subversion/libsvn_client/relocate.c
> (svn_client_relocate2): Handle case where prefix is too long
> to be valid for externals.
>
> * subversion/tests/cmdline/relocate_tests.py
> (relocate_with_relative_externals): Extend.
>
> Modified:
> subversion/trunk/subversion/libsvn_client/relocate.c
> subversion/trunk/subversion/tests/cmdline/relocate_tests.py
>
> Modified: subversion/trunk/subversion/libsvn_client/relocate.c
> URL:
> http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/re
> locate.c?rev=1723385&r1=1723384&r2=1723385&view=diff
> ==========================================================
> ====================
> --- subversion/trunk/subversion/libsvn_client/relocate.c (original)
> +++ subversion/trunk/subversion/libsvn_client/relocate.c Wed Jan 6
> 17:20:28 2016
> @@ -141,6 +141,8 @@ svn_client_relocate2(const char *wcroot_
> apr_hash_index_t *hi;
> apr_pool_t *iterpool = NULL;
> const char *old_repos_root_url, *new_repos_root_url;
> + char *sig_from_prefix, *sig_to_prefix;
> + apr_size_t index_from, index_to;
>
> /* Populate our validator callback baton, and call the relocate code. */
> vb.ctx = ctx;
> @@ -183,6 +185,21 @@ svn_client_relocate2(const char *wcroot_
> if (! apr_hash_count(externals_hash))
> return SVN_NO_ERROR;
>
> + /* A valid prefix for the main working copy may be too long to be
> + valid for an external. Trim any common trailing characters to
> + leave the significant part that changes. */
> + sig_from_prefix = apr_pstrdup(pool, from_prefix);
> + sig_to_prefix = apr_pstrdup(pool, to_prefix);
> + index_from = strlen(sig_from_prefix);
> + index_to = strlen(sig_to_prefix);
> + while (index_from && index_to
> + && sig_from_prefix[index_from] == sig_to_prefix[index_to])
> + {
> + sig_from_prefix[index_from] = sig_to_prefix[index_to] = '\0';
> + --index_from;
> + --index_to;
> + }
> +

I'm wondering, is it safe to do this this way... or should we use the safer svn_uri_dirname() to split of whole components from a url at a time.

Are there cases where this might match half a directory (or host) name?

        Bert
Received on 2016-01-06 18:43:20 CET

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.