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

Re: [PATCH] fix for issue 2475: ignore case for hostnames (repost)

From: Philip Martin <philip_at_codematters.co.uk>
Date: 2006-03-29 00:25:01 CEST

Lieven Govaerts <lgo@mobsol.be> writes:

> --- subversion/libsvn_subr/path.c (revision 18872)
> +++ subversion/libsvn_subr/path.c (working copy)
> @@ -23,6 +23,7 @@
>
> #include <apr_file_info.h>
> #include <apr_lib.h>
> +#include <apr_uri.h>
>
> #include "svn_string.h"
> #include "svn_path.h"
> @@ -1139,6 +1140,25 @@
>
> }
>
> + if (uri)
> + {
> + // convert hostname to lowercase

What about the scheme, should that be converted as well? Perhaps we
could then remove the tolower hack in svn_ra_dav__open?

> + apr_uri_t host_uri;
> + apr_size_t offset;
> + int i;
> +
> + apr_uri_parse(pool, path, &host_uri);

The overlap between skip_uri_scheme and apr_uri_parse is a bit
worrying, can we drop skip_uri_scheme just use apr_uri_parse
everywhere?

> +
> + for(i = 0; host_uri.hostname[i]; i++)
> + host_uri.hostname[i] = tolower(host_uri.hostname[i]);
> +
> + // path will be pointing to a new memory location, so update src to
> + // point to the new location too.
> + offset = src - path;
> + path = apr_uri_unparse(pool, &host_uri, APR_URI_UNP_REVEALPASSWORD);
> + src = path + offset;

Rather than overwriting host_uri and calculating a new path can you
simply copy the lower case stuff into dst?

> + }
> +
> while (*src)
> {
> /* Parse each segment, find the closing '/' */
> Index: subversion/libsvn_wc/entries.c
> ===================================================================
> --- subversion/libsvn_wc/entries.c (revision 18872)
> +++ subversion/libsvn_wc/entries.c (working copy)
> @@ -240,9 +240,12 @@
> {
> entry->url
> = apr_hash_get(atts, SVN_WC__ENTRY_ATTR_URL, APR_HASH_KEY_STRING);
> -
> - if (entry->url)
> - *modify_flags |= SVN_WC__ENTRY_MODIFY_URL;
> +
> + if (entry->url)
> + {
> + *modify_flags |= SVN_WC__ENTRY_MODIFY_URL;
> + entry->url = svn_path_canonicalize(entry->url, pool);
> + }
> }
>
> /* Set up repository root. Make sure it is a prefix of url. */
> @@ -251,6 +254,7 @@
> APR_HASH_KEY_STRING);
> if (entry->repos)
> {
> + entry->repos = svn_path_canonicalize(entry->repos, pool);
> if (entry->url && ! svn_path_is_ancestor(entry->repos, entry->url))
> return svn_error_createf(SVN_ERR_WC_CORRUPT, NULL,
> _("Entry for '%s' has invalid repository "

I guess this is repairing old working copies that have stored
non-canonical URLs, a repair that could be done manually using
--relocate? I don't know whether our policy these days is to trust
.svn data or not but we don't appear to force name to be canonical so
forcing the URLs is inconsistent. I suppose we can justify it since
we know that non-canonical URLs exist whereas the only known way to
get non-canonical names is to modify the .svn data outside of
Subversion.

In passing I see some old code handling svn:this_dir with a comment
saying it should be removed before 1.0!

-- 
Philip Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Mar 29 00:25:24 2006

This is an archived mail posted to the Subversion Dev mailing list.