[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: Russell Yanofsky <rey4_at_columbia.edu>
Date: 2003-09-12 21:11:38 CEST

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).

- Russ

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Sep 12 21:13:43 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.