From: Roman Kagan <rkagan@mail.ru>
To: git@vger.kernel.org
Cc: Roman Kagan <rkagan@mail.ru>,
Benjamin Pabst <benjamin.pabst85@gmail.com>,
Eric Wong <normalperson@yhbt.net>,
Jonathan Nieder <jrnieder@gmail.com>
Subject: [PATCH v2] git-svn: workaround for a bug in svn serf backend
Date: Fri, 27 Dec 2013 12:05:15 +0400 [thread overview]
Message-ID: <1388131515-3015-1-git-send-email-rkagan@mail.ru> (raw)
In-Reply-To: <20131226202805.GV20443@google.com>
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.
Cc: Benjamin Pabst <benjamin.pabst85@gmail.com>
Cc: Eric Wong <normalperson@yhbt.net>
Cc: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Roman Kagan <rkagan@mail.ru>
---
changes since v1:
- fix grammar in the patch and the log message
- refer to the triggered error message
perl/Git/SVN/Editor.pm | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/perl/Git/SVN/Editor.pm b/perl/Git/SVN/Editor.pm
index b3bcd47..34e8af9 100644
--- a/perl/Git/SVN/Editor.pm
+++ b/perl/Git/SVN/Editor.pm
@@ -304,8 +304,12 @@ sub C {
my ($self, $m, $deletions) = @_;
my ($dir, $file) = split_path($m->{file_b});
my $pbat = $self->ensure_path($dir, $deletions);
+ # workaround for a bug in svn serf backend (v1.8.5 and below):
+ # store third argument to ->add_file() in a local variable, to make it
+ # have the same lifetime as $fbat
+ my $upa = $self->url_path($m->{file_a});
my $fbat = $self->add_file($self->repo_path($m->{file_b}), $pbat,
- $self->url_path($m->{file_a}), $self->{r});
+ $upa, $self->{r});
print "\tC\t$m->{file_a} => $m->{file_b}\n" unless $::_q;
$self->chg_file($fbat, $m);
$self->close_file($fbat,undef,$self->{pool});
@@ -323,8 +327,10 @@ sub R {
my ($self, $m, $deletions) = @_;
my ($dir, $file) = split_path($m->{file_b});
my $pbat = $self->ensure_path($dir, $deletions);
+ # workaround for a bug in svn serf backend, see comment in C() above
+ my $upa = $self->url_path($m->{file_a});
my $fbat = $self->add_file($self->repo_path($m->{file_b}), $pbat,
- $self->url_path($m->{file_a}), $self->{r});
+ $upa, $self->{r});
print "\tR\t$m->{file_a} => $m->{file_b}\n" unless $::_q;
$self->apply_autoprops($file, $fbat);
$self->chg_file($fbat, $m);
--
1.8.4.2
next prev parent reply other threads:[~2013-12-27 8:06 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CAM-uYMgy8duxdGY8rbCJv9To3FFMAUDv22nnzbQ+e3QrTCLLpQ@mail.gmail.com>
[not found] ` <CAM-uYMigCTK=j3HkyT0F=jtDoDERdtkpZiTXRvBhSHJW3edJ-w@mail.gmail.com>
2013-11-14 15:26 ` Fwd: Error with git-svn pushing a rename Benjamin Pabst
2013-11-15 7:34 ` Andreas Stricker
[not found] ` <CAM-uYMgn4SGqurqRG-RDiicLxpf9NfTPUvNn9FaFUUbxFRJsZw@mail.gmail.com>
2013-11-15 13:36 ` Andreas Stricker
2013-11-15 22:53 ` Jonathan Nieder
2013-11-17 22:55 ` Andreas Stricker
2013-11-20 22:10 ` Benjamin Pabst
2013-12-24 21:11 ` Roman Kagan
2013-12-25 10:52 ` Roman Kagan
2013-12-25 13:13 ` Roman Kagan
2013-12-25 16:31 ` Thomas Rast
2013-12-26 12:05 ` [PATCH] git-svn: workaround for a bug in svn serf backend Roman Kagan
2013-12-26 20:28 ` Jonathan Nieder
2013-12-27 6:09 ` Roman Kagan
2013-12-27 7:52 ` Roman Kagan
2013-12-27 8:05 ` Roman Kagan [this message]
2013-12-27 20:07 ` [PATCH v2] " Jonathan Nieder
2013-12-27 20:34 ` Eric Wong
2013-12-27 22:22 ` Junio C Hamano
2013-12-28 9:58 ` Roman Kagan
2013-12-30 19:44 ` Junio C Hamano
2013-12-31 7:20 ` Roman Kagan
2014-01-17 11:32 ` Roman Kagan
2014-01-17 19:23 ` Junio C Hamano
2014-01-06 15:51 ` Andreas Stricker
2013-12-30 12:20 ` [PATCH] " Thomas Rast
2013-12-30 16:01 ` Roman Kagan
2013-11-18 17:59 ` Fwd: Error with git-svn pushing a rename Benjamin Pabst
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1388131515-3015-1-git-send-email-rkagan@mail.ru \
--to=rkagan@mail.ru \
--cc=benjamin.pabst85@gmail.com \
--cc=git@vger.kernel.org \
--cc=jrnieder@gmail.com \
--cc=normalperson@yhbt.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).