tags 618875 + patch thanks I submitted a git-svn patch for this issue upstream. The patch that I sent upstream is attached, as well as a script that reproduces a corrupted cache. If you want to reproduce the bug (which is a specific case of what this patch fixes), comment out the 'echo corrupted ...' line, run all but the last 3 lines on a 64 bit machine, and then run the last three lines on a 32 bit machine, in the same git repository.
-Jason Gross
From: Jason Gross <jgr...@mit.edu> Origin: http://thread.gmane.org/gmane.comp.version-control.git/179834 Forwarded: Yes Date: Sun, 21 Aug 2011 21:50:09 -0400 Subject: [PATCH] git-svn: Destroy the cache when we fail to read it Previously, we would fail fatally when trying to fetch changes with mergeinfo on a 32 bit machine, when the repository previously had fetched changes with mergeinfo on a 64 bit machine. This fixes bug 618875 (which is also 587650, 635097). Much of the code was written by Jonathan Nieder <jrnie...@gmail.com> with suggestions from Steffen Mueller <smuel...@cpan.org> (see http://lists.debian.org/debian-perl/2011/05/msg00023.html and http://lists.debian.org/debian-perl/2011/05/msg00026.html). Signed-off-by: Jason Gross <jgr...@mit.edu> Cc: Jonathan Nieder <jrnie...@gmail.com> --- git-svn.perl | 59 +++++++++++++++++++++++++++++++++++---------------------- 1 files changed, 36 insertions(+), 23 deletions(-) diff --git a/git-svn.perl b/git-svn.perl index 89f83fd..78ccdc8 100755 --- a/git-svn.perl +++ b/git-svn.perl @@ -1680,7 +1680,7 @@ use vars qw/$default_repo_id $default_ref_id $_no_metadata $_follow_parent $_use_svnsync_props $no_reuse_existing $_minimize_url $_use_log_author $_add_author_from $_localtime/; use Carp qw/croak/; -use File::Path qw/mkpath/; +use File::Path qw/mkpath rmtree/; use File::Copy qw/copy/; use IPC::Open3; use Memoize; # core since 5.8.0, Jul 2002 @@ -3198,28 +3198,41 @@ sub has_no_changes { $memoized = 1; my $cache_path = "$ENV{GIT_DIR}/svn/.caches/"; - mkpath([$cache_path]) unless -d $cache_path; - - tie my %lookup_svn_merge_cache => 'Memoize::Storable', - "$cache_path/lookup_svn_merge.db", 'nstore'; - memoize 'lookup_svn_merge', - SCALAR_CACHE => 'FAULT', - LIST_CACHE => ['HASH' => \%lookup_svn_merge_cache], - ; - - tie my %check_cherry_pick_cache => 'Memoize::Storable', - "$cache_path/check_cherry_pick.db", 'nstore'; - memoize 'check_cherry_pick', - SCALAR_CACHE => 'FAULT', - LIST_CACHE => ['HASH' => \%check_cherry_pick_cache], - ; - - tie my %has_no_changes_cache => 'Memoize::Storable', - "$cache_path/has_no_changes.db", 'nstore'; - memoize 'has_no_changes', - SCALAR_CACHE => ['HASH' => \%has_no_changes_cache], - LIST_CACHE => 'FAULT', - ; + my $do_memoization = sub { + mkpath([$cache_path]) unless -d $cache_path; + + tie my %lookup_svn_merge_cache => 'Memoize::Storable', + "$cache_path/lookup_svn_merge.db", 'nstore'; + memoize 'lookup_svn_merge', + SCALAR_CACHE => 'FAULT', + LIST_CACHE => ['HASH' => \%lookup_svn_merge_cache], + ; + + tie my %check_cherry_pick_cache => 'Memoize::Storable', + "$cache_path/check_cherry_pick.db", 'nstore'; + memoize 'check_cherry_pick', + SCALAR_CACHE => 'FAULT', + LIST_CACHE => ['HASH' => \%check_cherry_pick_cache], + ; + + tie my %has_no_changes_cache => 'Memoize::Storable', + "$cache_path/has_no_changes.db", 'nstore'; + memoize 'has_no_changes', + SCALAR_CACHE => ['HASH' => \%has_no_changes_cache], + LIST_CACHE => 'FAULT', + ; + }; + + if (not eval { + $do_memoization->(); + 1; + }) { + my $err = $@ || "Zombie error"; # "Zombie error" to catch clobbered $@ in buggy destructors + die $err unless -d $cache_path; + print STDERR "Discarding cache and trying again ($@)\n"; + rmtree([$cache_path]); + $do_memoization->(); + } } sub unmemoize_svn_mergeinfo_functions { -- 1.7.2.3
test-git-svn-64.sh
Description: Bourne shell script