[Mailman-Developers] bug in ListAdmin._UpdateRecords in 2.1.5 - 2.1.6b4?

Zoran Dzelajlija jelly+mailman-dev at mail.iskon.hr
Tue Mar 15 21:45:07 CET 2005


I have been trying to migrate from 2.0.13 to 2.1.5 a few lists at a time,
and run 2.0 and 2.1 in parallel.  We have a lot of pending requests around,
and we would not like to lose them.  Luckily, it looks like almost
everything is handled in bin/update, although some things require special
attention, like pending_subscriptions.db (haven't tried yet, but it looks
like it should be enough to copy it over to the Mailman 2.1 installation
each time a list is migrated, and run bin/update or the relevant portion
thereof). Most other stuff is done on a per-list basis, like held messages.

class ListAdmin has an sort-of-private function _UpdateRecords, used in
bin/update to upgrade from 2.0-style request.db which holds the held
messages metadata.  It writes the entries to the new database like this:

if op == SUBSCRIPTION:              
    # Here's the new layout
    self.__db[id] = when, addr, fullname, passwd, digest, lang

However, other code uses it like:

type, data = self.__db[id]

Seems like the correct way should be something like

    self.__db[id] = TYPE, (when, addr, fullname, passwd, digest, lang)

I'v made a script to mv files and directories from 2.0 to 2.1 installation,
fix the aliases, and do stuff withlist, _UpdateRecords() among other.
After this, some of the migrated lists would have munged requests without 
a request type.  AFAICT this would happen on a regular 2.0.x -> 2.1.5 
upgrade with bin/update too.

So here's a patch for 2.1.5 which includes crude heuristics to guess the
forgotten request type, it can be used in withlist to fix the damage, or in
bin/update.  I'm not sure if this is adequate to put in the main tree.  It
applies to 2.1.6b4 too, but I've not tested yet if it works.  Should I file
a bug report at sourceforge?


Index: ListAdmin.py
RCS file: /var/lib/cvs/mailman-conf/ListAdmin.py,v
retrieving revision 1.1
retrieving revision 1.3
diff -u -r1.1 -r1.3
--- ListAdmin.py	7 Sep 2004 02:48:50 -0000	1.1
+++ ListAdmin.py	7 Sep 2004 03:33:17 -0000	1.3
@@ -530,7 +530,19 @@
             except IOError, e:
                 if e.errno <> errno.ENOENT: raise
                 self.__db = {}
-        for id, (op, info) in self.__db.items():
+        for id, rest in self.__db.items():
+            if len(rest) == 2:
+                op, info = rest
+            # repair junk from 2.1.5
+            elif len(rest) == 6:
+                op = SUBSCRIPTION
+                if len(rest[5]) > 10 and rest[2] != '':
+                    op = HELDMSG
+                self.__db[id] = op, rest
+                continue
+            else:
+                assert len(rest) == 2, 'Found broken database'
+                continue
             if op == SUBSCRIPTION:
                 if len(info) == 4:
                     # pre-2.1a2 compatibility
@@ -545,7 +557,7 @@
                     assert len(info) == 6, 'Unknown subscription record layout'
                 # Here's the new layout
-                self.__db[id] = when, addr, fullname, passwd, digest, lang
+                self.__db[id] = op, (when, addr, fullname, passwd, digest, lang)
             elif op == HELDMSG:
                 if len(info) == 5:
                     when, sender, subject, reason, text = info
@@ -554,7 +566,7 @@
                     assert len(info) == 6, 'Unknown held msg record layout'
                 # Here's the new layout
-                self.__db[id] = when, sender, subject, reason, text, msgdata
+                self.__db[id] = op, (when, sender, subject, reason, text, msgdata)
         # All done

More information about the Mailman-Developers mailing list