Skip to content

Commit ac93028

Browse files
rvkagitster
authored andcommitted
git-svn: workaround for a bug in svn serf backend
Subversion serf backend in versions 1.8.5 and below has a bug(*) that the function creating the descriptor of a file change -- add_file() -- doesn't make a copy of its third argument when storing it on the returned descriptor. As a result, by the time this field is used (in transactions of file copying or renaming) it may well be released, and the memory reused. One of its possible manifestations is the svn assertion triggering on an invalid path, with a message svn_fspath__skip_ancestor: Assertion `svn_fspath__is_canonical(child_fspath)' failed. This patch works around this bug, by storing the value to be passed as the third argument to add_file() in a local variable with the same scope as the file change descriptor, making sure their lifetime is the same. * [ew: fixed in Subversion r1553376 as noted by Jonathan Nieder] Cc: Benjamin Pabst <[email protected]> Signed-off-by: Eric Wong <[email protected]> Reviewed-by: Jonathan Nieder <[email protected]> Signed-off-by: Roman Kagan <[email protected]>
1 parent 4224916 commit ac93028

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

perl/Git/SVN/Editor.pm

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,8 +304,12 @@ sub C {
304304
my ($self, $m, $deletions) = @_;
305305
my ($dir, $file) = split_path($m->{file_b});
306306
my $pbat = $self->ensure_path($dir, $deletions);
307+
# workaround for a bug in svn serf backend (v1.8.5 and below):
308+
# store third argument to ->add_file() in a local variable, to make it
309+
# have the same lifetime as $fbat
310+
my $upa = $self->url_path($m->{file_a});
307311
my $fbat = $self->add_file($self->repo_path($m->{file_b}), $pbat,
308-
$self->url_path($m->{file_a}), $self->{r});
312+
$upa, $self->{r});
309313
print "\tC\t$m->{file_a} => $m->{file_b}\n" unless $::_q;
310314
$self->chg_file($fbat, $m);
311315
$self->close_file($fbat,undef,$self->{pool});
@@ -323,8 +327,10 @@ sub R {
323327
my ($self, $m, $deletions) = @_;
324328
my ($dir, $file) = split_path($m->{file_b});
325329
my $pbat = $self->ensure_path($dir, $deletions);
330+
# workaround for a bug in svn serf backend, see comment in C() above
331+
my $upa = $self->url_path($m->{file_a});
326332
my $fbat = $self->add_file($self->repo_path($m->{file_b}), $pbat,
327-
$self->url_path($m->{file_a}), $self->{r});
333+
$upa, $self->{r});
328334
print "\tR\t$m->{file_a} => $m->{file_b}\n" unless $::_q;
329335
$self->apply_autoprops($file, $fbat);
330336
$self->chg_file($fbat, $m);

0 commit comments

Comments
 (0)