Fix for SVN::Web and ‘subversion/libsvn_ra/deprecated.c’ line 289: assertion failed (*path != ‘/’)

Updated: April 22nd 2009:
This issue is actually SVN::Web Bug 37388. I didn’t see that because I that bug was filed using the error messages for SVN v1.5.0 and the function svn_ra_get_log() that is called is in a totally different library in v1.6.0 so searches for the v1.6.0 error do not find that bug report or the patches. Thanks to commenter Alexandr for drawing this to my attention.

After upgrading to subversion 1.6.0 I wanted to use SVN::Web to provide web access to my Subversion repo.

To use SVN::Web you’ll need to install the SVN bindings for Perl. These come with subversion, but they’re not installed by default. You can find the installation information in

subversion/bindings/swig/INSTALL

In summary they require SWIG and SVN be installed. Once you’ve done this from the root of the source directory run

  • make swig-pl
  • make check-swig-pl
  • make install-swig-pl

Pretty simple stuff and then you can install SVN::Web.

Once SVN::Web is installed you can use the command “svnweb-install” to setup the directory for the web site that will serve your SVN repo information. This creates a file called index.cgi and the config.yaml that you need to configure it.

I have a number of repos installed under a single root, so I used the reposparent option to set the root to all of them using this value:

reposparent: '/usr/local/svn/repositories'

Calling up the site in my browser I’m presented with a list of the repos. However this is where things go wrong because when you click on a link you see a blank page . If you check the web server error log then you’ll see the following error message:

svn: In file 'subversion/libsvn_ra/deprecated.c' line 289: assertion failed (*path != '/')
Premature end of script headers: index.cgi

So I began to search through the Perl code, the XS and finally the subversion libraries trying to track down what was wrong with this code. Why did it matter that the path started with /? I wasn’t able to see anything obvious, including doing lots of searches for this error text and variants of it to see what other people had found.

I found nothing until I happened to search for svn_ra_get_log() and in doing so stumbled across this conversion thread from the svn-dev mailing list “subversion/libsvn_ra/ra_loader.c:934: svn_ra_get_log: Assertion `*path != ‘/” failed.

This thread refers to a different svn lib because it appears that the function svn_ra_get_log() is deprecated in 1.6.0, but for legacy purposes (such as our code) it can’t be removed yet. This chances the library and the line number, but otherwise the error is the same. It turns out that’s because it is the same problem – you used to pass the first parameter as ‘/’ to svn_ra_get_log() (which is known as get_log() in the Perl bindings) to indicate that you wanted any logs. Now you need to pass an empty string.

The reason why this is a problem is that in SVN::Web::action::recent_interesting_rev() $ra->get_log() is called with $path = ‘/’. The fix then is really simple – force $path to be an empty string before get_log() is called. Since I didn’t know what/where else this would break I patched it as close to the error as possible by adding this to line 244 of SVN::Web::action.pm as shown below;

243     my @log_result;
244 $path =~ s!^/!!;
245     $ra->get_log([$path], $rev, 1, 1, 0, 1,
246                  sub { @log_result = @_; });

Hope this helps anyone else who encounters this error.

Colin.

Advertisements

9 Responses to Fix for SVN::Web and ‘subversion/libsvn_ra/deprecated.c’ line 289: assertion failed (*path != ‘/’)

  1. You should publish you patch at bugtracker for SVN::Web: http://rt.cpan.org/Public/Dist/Display.html?Name=SVN-Web

    • perladmin says:

      Thanks for your suggestion. I hadn’t even thought about getting to this point. As it happens this was good for two reasons. Firstly my solution is not complete, I found other modules that required similar fixes. Secondly it turns out it is already known about. This same issue is addressed in Bug #37388 which also contains patches that have been submitted.

      I didn’t find this because the bug uses the error messages from subversion 1.5.0 but the called function has been moved to a new library in v1.6.0 and so doesn’t match. I’ve updated my post here to note this as well as updating this bug report to include the svn v1.6.0 error message with the hope that people searching in future will end up on that bug report rather than finding no results.

      Again, thank you.

  2. jgoulah says:

    awesome, helped me out!

  3. Sit says:

    Thank you Colin. This saved me a lot of time!

    In addition to action.pm, there were some other .pm files that I needed to change too.

    grep -l get_log *.pm

    And in some of those .pm files, get_log() is not the only consumer of $path and altering $path actually causes a failure downstream. In that case, I enhanced your fix slightly so that get_log() uses a separate, dedicated $modified_path. e.g.,

    In View.pm line 137:

    {
    my $modified_path = $path;
    $modified_path =~ s!^/!!;
    $ra->get_log([$modified_path], $rev, $rev, 1, 1, 1,
    sub { $self->{REV} = $self->_log(@_) });
    }

    BTW, I used svn 1.6.3 and it still had this issue.

    Thanks!

  4. cbass says:

    Thanks. I was about to slit my wrists

  5. cbass says:

    I forgot to mention that I fixed this problem in /usr/bin/git-svnimport, line 955 (just search for get_log).

    The new line reads as follows:

    $svn->{‘svn’}->get_log([“”],$from_rev,$to_rev,0,1,1,\&commit_all,$pool)

  6. Jake says:

    This fixed my problem. Thanks!

  7. Coffeenod says:

    many thanks, saved my day!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: