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

Re: cvs2svn change_path crash - Windows

From: Max Bowsher <maxb_at_ukf.net>
Date: 2003-09-13 00:23:36 CEST

Russell Yanofsky wrote:
> Martin Fuchs wrote:
>> Hello Russel,
>>
>>> There's a small patch which fixes this issue and some other cvs2svn
>>> windows problems here:
>>>
>>> http://subversion.tigris.org/servlets/ReadMsg?list=dev&msgNo=41909
>>>
>>> It might be a little out of date now though.
>>
>> Thank you, I applied it with a small adjustment on the current source
>> code. Attached is the diff against revision 7003.
>
> Thanks for taking the time to test this patch.
>
> I see that you changed the implementation of relative_name from:
>
> def relative_name(cvsroot, fname):
> l = len(cvsroot)
> assert fname[:l] == cvsroot and fname[l] == os.sep
> return string.replace(fname[l+1:], os.sep, '/')
>
> to
>
> def relative_name(cvsroot, fname):
> l = len(cvsroot)
> if fname[:l] == cvsroot:
> if fname[l] == os.sep:
> return string.replace(fname[l+1:], os.sep, '/')
> return string.replace(fname[l:], os.sep, '/')
> sys.stderr.write('relative_path("%s", "%s"): fname is not a sub-path
of'
> ' cvsroot\n' % (cvsroot, fname))
> sys.exit(1)
>
> I'm not sure why though. If fname[l] is not the seperator character, then
> that either means that fname[l:] is the empty string, making the second
> replace operation unneccessary, or that fname begins with a path other
than
> the cvsroot, which means an error should be thrown. Was this change
actually
> needed to get the patch to run with the new code?
>
> Also I think that using an assertion is a more appropriate way of handling
> this error than calling sys.exit because the only thing that can cause it
to
> be triggered is programmer error (incorrect usage of the relative_name
> function).

I like Martin's choice, because it removes unrelated refactoring from the
patch - reducing the amount of changes for me to review before I can commit
them.

If you want to refactor error handling, that should be a seperate patch, not
mixed in with windows-compatibility changes.

Max.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Sep 13 00:24:24 2003

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.