From: Brian Warner <warner@lothar.com>
Date: Tue, 24 Feb 2009 05:14:05 +0000 (-0700)
Subject: immutable/checker.py: trap ShareVersionIncompatible too. Also, use f.check
X-Git-Url: https://git.rkrishnan.org/specifications/install.html?a=commitdiff_plain;h=f95e9b5964be3e729eeee3fb04fe947e7ef26d8b;p=tahoe-lafs%2Ftahoe-lafs.git

immutable/checker.py: trap ShareVersionIncompatible too. Also, use f.check
instead of examining the value returned by f.trap, because the latter appears
to squash exception types down into their base classes (i.e. since
ShareVersionIncompatible is a subclass of LayoutInvalid,
f.trap(Failure(ShareVersionIncompatible)) == LayoutInvalid).

All this resulted in 'incompatible' shares being misclassified as 'corrupt'.
---

diff --git a/src/allmydata/immutable/checker.py b/src/allmydata/immutable/checker.py
index 22297be6..74343639 100644
--- a/src/allmydata/immutable/checker.py
+++ b/src/allmydata/immutable/checker.py
@@ -141,14 +141,15 @@ class Checker(log.PrefixingLogMixin):
                               rrefutil.ServerFailure,
                               layout.LayoutInvalid,
                               layout.RidiculouslyLargeURIExtensionBlock,
+                              layout.ShareVersionIncompatible,
                               download.BadOrMissingHash,
                               download.BadURIExtensionHashValue)
 
-            if failtype is DeadReferenceError:
+            if f.check(DeadReferenceError):
                 return (False, sharenum, 'disconnect')
-            elif failtype is rrefutil.ServerFailure:
+            elif f.check(rrefutil.ServerFailure):
                 return (False, sharenum, 'failure')
-            elif failtype is layout.ShareVersionIncompatible:
+            elif f.check(layout.ShareVersionIncompatible):
                 return (False, sharenum, 'incompatible')
             else:
                 return (False, sharenum, 'corrupt')