@matheusbsbs / matheus-bagliano / commits / 8ac3a66702
Fork 0

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 8bff7c538 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>

Sergey Vlasov committed Jul 18, 2010 at 16:17 UTC 8ac3a66702c43386eb580b7a1a8b1a31cd675327
1 file changed +16
git-svn.perl
+16
@@ -3169,6 +3169,22 @@ sub has_no_changes {
3169 LIST_CACHE => 'FAULT',
3170 ;
3171 }
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();
3188 }
3189
3190 sub parents_exclude {