[svk-devel] Problem in SVN::Mirror::Ra.pm

Rolf Schäuble mailinglists at rschaeuble.de
Thu Oct 26 17:40:51 EDT 2006


Over the last days, I was hunting down two problems that I had with  
SVK. It turned out to be a problem in SVN::Mirror::Ra.pm. I don't  
know if this is the right place for reports on that code, but since  
the code was written by the author of svk, I will start here.
Please tell me if it would be better to report it on a subversion  
mailing list.

The first problem was what I reported in a mail to this list with the  
title "Error on svk sync -s". After I have first found (and fixed)  
the second problem, I now understand what was going on. The client  
was sending a log request for the revision range -1:-1 to the  
subversion server, which responded with an empty answer. I just don't  
know why it always worked when I tried it from work. Maybe because of  
the combination of client and server svn libs? Unfortunately, I don't  
know which version of svn that server runs; it doesn't report it in  
its answers.

The second problem I had was using 'sync -s' on the URL http:// 
svn.python.org/projects/python/trunk (this server is running svn  
1.1.4). Here the problem was different. SVK spent hours communicating  
with the svn server, but never achieved anything. After sniffing the  
network connection, I found that it sent the same sequence of REPORT  
and a few PROPGET (I think that was it, if someone asks for it, I can  
provide the ethereal logs) over and over again.
After this, I started to write a small test client, just using the  
SVN::* classes directly, to track down the problem. In the end I  
found it in SVN::Mirror::Ra.pm. In get_latest_rev(), it ran into the  
until/if block, where it sends a log request in the range -1:-1. This  
request is answered with an empty response by the server, so $rev  
stays undefined. This causes the "until (defined $ref)" loop to run  
again and again and again.....
I fixed this by changing that get_log call to query for the range  
-1:0. That seems to work, both over dav as well as on local  
repositories. I haven't tried it over svnserver yet, though.

There are a few points about get_latest_rev which I don't understand:

-  Why did this work ever before? Was there a change in some version  
of subversion, redefining the meaning of -1:-1?
- What is the line
     my $_start = $self->{rsource} =~ m/^file/ ? 0 : -1;
   good for? Especially when my 'fix' is to always use the value '0'.
- Would my change break anything? I changed the get_log call to this:
    $ra->get_log ([''], $ra->get_latest_revnum, 0, 1, 0, 1, sub  
{ $rev = $_[1] });
    always querying the log in the range -1:0. It would be especially  
interesting to know if that doesn't work with older clients or  
servers. I can't really test this myself right now.
- Does anyone know a bit more about the problem that long comment in  
get_latest_rev refers to? I think it's missing a few details. Also,  
the until/else block looks a bit strange to me. And when I tested it,  
it didn't work.

I will send a patch with my changes this weekend. But since I know  
much too less about SVN and SVK, it would be great to get some  
comments and answers.


More information about the svk-devel mailing list