Update of /cvsroot/mailman/mailman/Mailman
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3154

Modified Files:
      Tag: Release_2_1-maint
        MailList.py 
Log Message:
Load(), __fix_corrupt_pckfile(): We should only rotate the corrupt pickle
files when the list lock is held.


Index: MailList.py
===================================================================
RCS file: /cvsroot/mailman/mailman/Mailman/MailList.py,v
retrieving revision 2.100.2.16
retrieving revision 2.100.2.17
diff -u -d -r2.100.2.16 -r2.100.2.17
--- MailList.py 29 Feb 2004 23:05:51 -0000      2.100.2.16
+++ MailList.py 4 Mar 2004 03:35:36 -0000       2.100.2.17
@@ -575,7 +575,7 @@
         self.__timestamp = mtime
         return dict, None
 
-    def Load(self, check_version=1):
+    def Load(self, check_version=True):
         if not Utils.list_exists(self.internal_name()):
             raise Errors.MMUnknownListError
         # We first try to load config.pck, which contains the up-to-date
@@ -608,7 +608,26 @@
             raise Errors.MMCorruptListDatabaseError, e
         # Now, if we didn't end up using the primary database file, we want to
         # copy the fallback into the primary so that the logic in Save() will
-        # still work.  For giggles, we'll copy it to a safety backup.
+        # still work.  For giggles, we'll copy it to a safety backup.  Note we
+        # MUST do this with the underlying list lock acquired.
+        unlock = True
+        try:
+            try:
+                self.__lock.lock()
+            except LockFile.AlreadyLockedError:
+                unlock = False
+            self.__fix_corrupt_pckfile(file, pfile, plast, dfile, dlast)
+        finally:
+            if unlock:
+                self.__lock.unlock()
+        # Copy the loaded dictionary into the attributes of the current
+        # mailing list object, then run sanity check on the data.
+        self.__dict__.update(dict)
+        if check_version:
+            self.CheckVersion(dict)
+            self.CheckValues()
+
+    def __fix_corrupt_pckfile(self, file, pfile, plast, dfile, dlast):
         if file == plast:
             # Move aside any existing pickle file and delete any existing
             # safety file.  This avoids EPERM errors inside the shutil.copy()
@@ -637,12 +656,6 @@
                 if e.errno <> errno.ENOENT: raise
             shutil.copy(file, dfile)
             shutil.copy(file, dfile + '.safety')
-        # Copy the loaded dictionary into the attributes of the current
-        # mailing list object, then run sanity check on the data.
-        self.__dict__.update(dict)
-        if check_version:
-            self.CheckVersion(dict)
-            self.CheckValues()
 
 
     #


_______________________________________________
Mailman-checkins mailing list
[EMAIL PROTECTED]
Unsubscribe: http://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org

Reply via email to