Add a patch from the git mailing list fixing a problem with 'git svn':

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 3d 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.

This patch works around this bug, by storing the value to be passed as
the 3d 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 <at> gmail.com>
Cc: Eric Wong <normalperson <at> yhbt.net>
Signed-off-by: Roman Kagan <rkagan <at> mail.ru>
---
 perl/Git/SVN/Editor.pm | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

http://permalink.gmane.org/gmane.comp.version-control.git/239690
This commit is contained in:
wiz 2014-01-14 18:49:55 +00:00
parent 2e86a1f9ad
commit 644c42ccff
3 changed files with 55 additions and 3 deletions

View file

@ -1,9 +1,9 @@
# $NetBSD: Makefile,v 1.7 2013/12/09 14:17:42 obache Exp $
# $NetBSD: Makefile,v 1.8 2014/01/14 18:49:55 wiz Exp $
.include "../../devel/git/Makefile.common"
PKGNAME= git-base-${GIT_VERSION}
PKGREVISION= 1
PKGREVISION= 2
COMMENT= GIT Tree History Storage Tool (base package)
CONFLICTS+= scmgit-base-[0-9]*

View file

@ -1,4 +1,4 @@
$NetBSD: distinfo,v 1.8 2014/01/01 16:05:51 bsiegert Exp $
$NetBSD: distinfo,v 1.9 2014/01/14 18:49:55 wiz Exp $
SHA1 (git-1.8.5.2.tar.gz) = 3a09d6d5d4e31c702f17e664a527b4c2f6e84faf
RMD160 (git-1.8.5.2.tar.gz) = 0bbfd241bdb60c3b5e2ca74c06257187f9427b91
@ -12,4 +12,5 @@ SHA1 (patch-ah) = f22a2160631fb624e9e20616c68ad1a4aa2bebc7
SHA1 (patch-ai) = 56b63d4790a11f5eb128186ad5efdd1bcf102f2e
SHA1 (patch-config.mak.uname) = 6321f0e0d941d04fdd378b2341c2ba1c938441a3
SHA1 (patch-git-compat-util.h) = 788800c9972faadef40ad7ef795ed72305bfa292
SHA1 (patch-perl_Git_SVN_Editor.pm) = 50721693d2a23ff7f8d19db49f2427dbf446eee5
SHA1 (patch-wrapper.c) = d8252c63cca9a134fca3f8f6f28663f563c7b4bc

View file

@ -0,0 +1,51 @@
$NetBSD: patch-perl_Git_SVN_Editor.pm,v 1.1 2014/01/14 18:49:55 wiz Exp $
[PATCH] 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 3d 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.
This patch works around this bug, by storing the value to be passed as
the 3d 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 <at> gmail.com>
Cc: Eric Wong <normalperson <at> yhbt.net>
Signed-off-by: Roman Kagan <rkagan <at> mail.ru>
---
perl/Git/SVN/Editor.pm | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
http://permalink.gmane.org/gmane.comp.version-control.git/239690
--- perl/Git/SVN/Editor.pm.orig 2013-12-17 23:46:08.000000000 +0000
+++ 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 3d 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);