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

Re: svn commit: r33201 - in trunk/subversion: libsvn_wc tests/cmdline

From: Daniel Shahaf <d.s_at_daniel.shahaf.name>
Date: Sat, 20 Sep 2008 11:07:48 +0300 (Jerusalem Daylight Time)

Daniel Shahaf wrote on Sat, 20 Sep 2008 at 10:40 +0300:
> > Modified: trunk/subversion/libsvn_wc/copy.c
> > URL: http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_wc/copy.c?pathrev=33201&r1=33200&r2=33201
> > ==============================================================================
> > --- trunk/subversion/libsvn_wc/copy.c Fri Sep 19 17:55:55 2008 (r33200)
> > +++ trunk/subversion/libsvn_wc/copy.c Fri Sep 19 18:05:40 2008 (r33201)
> > @@ -316,8 +316,15 @@ get_copyfrom_url_rev_via_parent(const ch
> > svn_wc_adm_access_t *src_access,
> > apr_pool_t *pool)
> > {
> > - const char *parent_path = svn_path_dirname(src_path, pool);
> > - const char *rest = svn_path_basename(src_path, pool);
> > + const char *parent_path;
> > + const char *rest;
> > + const char *abs_src_path;
> > +
> > + SVN_ERR(svn_path_get_absolute(&abs_src_path, src_path, pool));
> > +
> > + parent_path = svn_path_dirname(abs_src_path, pool);
> > + rest = svn_path_basename(abs_src_path, pool);
> > +
> > *copyfrom_url = NULL;
> >
> > while (! *copyfrom_url)
> > @@ -353,9 +360,25 @@ get_copyfrom_url_rev_via_parent(const ch
> > }
> > else
> > {
> > + const char *last_parent_path = parent_path;
> > +
> > rest = svn_path_join(svn_path_basename(parent_path, pool),
> > rest, pool);
> > parent_path = svn_path_dirname(parent_path, pool);
> > +
> > + if (strcmp(parent_path, last_parent_path) == 0)
> > + {
>
> To clarify: do you know of a way to make this strcmp() return 0,

without manually corrupting the wc; just using svn commands. In other
words, would this 'if' ever be entered to on a non-corrupt wc?

Daniel
(Just trying to understand the situation -- I'm certainly not saying that
infinite loops on corrupt wc's are permissible!)

> or are
> just coding defensively to avoid any possibility of infinite loop here
> in the future?
>
> > + /* If this happens, it probably means that parent_path is "".
> > + But there's no reason to limit ourselves to just that case;
> > + given everything else that's going on in this function, a
> > + strcmp() is pretty cheap, and the result we're trying to
> > + prevent is an infinite loop if svn_path_dirname() returns
> > + its input unchanged. */
> > + return svn_error_createf
> > + (SVN_ERR_WC_COPYFROM_PATH_NOT_FOUND, NULL,
> > + _("no parent with copyfrom information found above '%s'"),
> > + svn_path_local_style(src_path, pool));
> > + }
> > }
> > }
> >
> >

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-09-20 10:07:59 CEST

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.