Skip to content

Commit 8ac3a66

Browse files
sigprofEric Wong
authored andcommitted
git-svn: write memoized data explicitly to avoid Storable bug
Apparently using the Storable module during global destruction is unsafe - there is a bug which can cause segmentation faults: http://rt.cpan.org/Public/Bug/Display.html?id=36087 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=482355 The persistent memoization support introduced in commit 8bff7c5 relied on global destruction to write cached data, which was leading to segfaults in some Perl configurations. Calling Memoize::unmemoize in the END block forces the cache writeout to be performed earlier, thus avoiding the bug. Signed-off-by: Sergey Vlasov <vsu@altlinux.ru> Acked-by: Eric Wong <normalperson@yhbt.net>
1 parent 24e7a5b commit 8ac3a66

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

git-svn.perl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3169,6 +3169,22 @@ sub has_no_changes {
31693169
LIST_CACHE => 'FAULT',
31703170
;
31713171
}
3172+
3173+
sub unmemoize_svn_mergeinfo_functions {
3174+
return if not $memoized;
3175+
$memoized = 0;
3176+
3177+
Memoize::unmemoize 'lookup_svn_merge';
3178+
Memoize::unmemoize 'check_cherry_pick';
3179+
Memoize::unmemoize 'has_no_changes';
3180+
}
3181+
}
3182+
3183+
END {
3184+
# Force cache writeout explicitly instead of waiting for
3185+
# global destruction to avoid segfault in Storable:
3186+
# http://rt.cpan.org/Public/Bug/Display.html?id=36087
3187+
unmemoize_svn_mergeinfo_functions();
31723188
}
31733189

31743190
sub parents_exclude {

0 commit comments

Comments
 (0)