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

bug in repos_replay

From: David Glasser <glasser_at_mit.edu>
Date: 2007-01-11 19:08:11 CET

GCC's r120621 seems to have triggered a bug in svn_repos_replay.

repos_replay has the feature of letting you replay a revision which
includes copies from places that you can't read. This can occur
because the RA session is rooted at, say, /trunk, and the copy comes
from outside of /trunk, or because authz rules prevent you from
reading the place where it is copied from. It makes it look like the
file or directory structure was freshly added by using a series of
add_directory/add_file calls without copy_froms. This is implemented
in the add_subdir function in libsvn_repos/replay.c.

add_subdir is originally called from path_driver_cb_func, which is
called by svn_delta_path_driver, which makes sure that we don't break
delta editor ordering rules. Except... if add_subdir decides to make
a bunch of extra calls, we can end up breaking the rules!

In the following reproduction recipe, we create at r1 this repo:

there/A/B
here/

At r2 we copy there/A into here/, and also modify a property on the
new here/A/B.

The reproduction script triggers the bug via the perl bindings to RA
replay, by replaying r2 against here/ only. It shouldn't be hard to
write a little C program that does the same thing. Alternatively,
after creating the repo, make an authz that prevents there/ from being
read, run svnserve, and run svnsync against the svnserved repo.
(svnsync doesn't support syncing from anywhere but the root of a
repository, so the "syncing too low" case can't be tested with
svnsync.)

This is the output that I get from foo.pl:
SVK::Editor=HASH(0x18f476c) set_target_revision 2 at
/opt/local/lib/perl5/vendor_perl/5.8.8/darwin-2level/SVN/Ra.pm line 85
SVK::Editor=HASH(0x18f476c) open_root
-1,_p_apr_pool_t=SCALAR(0x18f4b2c) at
/opt/local/lib/perl5/vendor_perl/5.8.8/darwin-2level/SVN/Ra.pm line 85
SVK::Editor=HASH(0x18f476c) open_directory
here,,-1,_p_apr_pool_t=SCALAR(0x18f4c1c) at
/opt/local/lib/perl5/vendor_perl/5.8.8/darwin-2level/SVN/Ra.pm line 85
SVK::Editor=HASH(0x18f476c) add_directory
here/A,,,-1,_p_apr_pool_t=SCALAR(0x18f4c1c) at
/opt/local/lib/perl5/vendor_perl/5.8.8/darwin-2level/SVN/Ra.pm line 85
SVK::Editor=HASH(0x18f476c) add_directory
here/A/B,,,-1,_p_apr_pool_t=SCALAR(0x18f4c1c) at
/opt/local/lib/perl5/vendor_perl/5.8.8/darwin-2level/SVN/Ra.pm line 85
SVK::Editor=HASH(0x18f476c) close_directory
,_p_apr_pool_t=SCALAR(0x18f4a30) at
/opt/local/lib/perl5/vendor_perl/5.8.8/darwin-2level/SVN/Ra.pm line 85
SVK::Editor=HASH(0x18f476c) open_directory
here/A/B,,-1,_p_apr_pool_t=SCALAR(0x18f4b2c) at
/opt/local/lib/perl5/vendor_perl/5.8.8/darwin-2level/SVN/Ra.pm line 85
Filesystem has no item: File not found: revision 1, path '/here/A/B'
at foo.pl line 3

ie, it calls close_directory on A/B and then tries to open it again,
which is not good. Or at least I think that's the problem.

I'm not sure that I'll have much more time to track this one down...

--dave

#!/bin/bash

S=svn
SA=svnadmin

rm -rf r w foo.pl

$SA create r
U=file://`pwd`/r
$S co $U w
cd w
$S mkdir here there
$S mkdir there/A
$S mkdir there/A/B
$S ci -m "original structure"

$S cp there/A here/
$S ps foo bar here/A/B
$S ci -m "copy with mod from there to here"
cd ..

echo 'use SVN::Core; use SVN::Ra; use SVK::Editor;' >foo.pl
echo 'my $ra = SVN::Ra->new("file://'`pwd`'/r/here");' >>foo.pl
echo '$ra->replay(2, 0, 1, SVK::Editor->new({_debug=>1}));' >>foo.pl

perl foo.pl

-- 
David Glasser | glasser_at_mit.edu | http://www.davidglasser.net/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Jan 11 20:42:08 2007

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.