[Mailman-Developers] admin approval and list archive

Thomas Wouters thomas@xs4all.net
Fri, 24 Mar 2000 23:57:27 +0100


--BwCQnh7xodEAoBMC
Content-Type: text/plain; charset=us-ascii


There seems to be a bug in the pipermail archiving in combination with admin
aproved messages. The bug is that, in the archive mbox, 'From ' lines will
be missing from messages which have been passed through admin approval,
which means that they will be considered part of the previous message or, if
there is no previous message, that the mbox is invalid and no archive will
be built.

This happens because of one or two buglets, one in the mailbox standard
module, and one possibly in the rfc822 module or otherwise in Mailman. When
holding a message, the code uses 'str(msg)' (where msg is a rfc822.Message
instance) to dump the pending message to a file. Unfortunately,
rfc822.Message.__str__() only dumps the normal mail headers and the body,
and *not* the 'From ' line, which is stored in rfc822.Message.unixfrom. I
dont really think that is a bug in the rfc822 module, as the 'From ' line is
not rfc822 but a sendmail (i think) addon for its own use, but it needs to
be worked around in any case. The simple fix is attached.

In the course of tracking this bug I also found out that the mailbox
standard module drops the 'From ' line entirely, before it passes the
message to the rfc822.Message constructor. At first I thought that this
caused the problem, but now I'm not entirely sure, and I'm not in a position
to test it at the moment. This is a bug though, but not in Mailman, and I
already sent a fix for it to the python patches list. If anyone is willing
to test this, and the above fix doesn't work on its own, grab the mailbox.py
fix from the patches mailarchive.

And, er, my apologies for this large a rant on this small a bug, it's late
and I'm overworked, not spending enough time with python ;)

PS: there'll probably be some offset in this patch, my cvs tree is still
cluttered with unshared hacks ;) even if it fails, though, I'm confident
most people will be able to apply it by hand ;)

-- 
Thomas Wouters <thomas@xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!

--BwCQnh7xodEAoBMC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=cvsdiff

Index: Mailman/ListAdmin.py
===================================================================
RCS file: /projects/cvsroot/mailman/Mailman/ListAdmin.py,v
retrieving revision 1.28
diff -u -r1.28 ListAdmin.py
--- ListAdmin.py	2000/03/21 06:24:59	1.28
+++ ListAdmin.py	2000/03/24 22:51:54
@@ -139,7 +145,7 @@
         omask = os.umask(002)
         try:
             fp = open(os.path.join(mm_cfg.DATA_DIR, filename), 'w')
-            fp.write(str(msg))
+            fp.write(msg.unixfrom + str(msg))
             fp.close()
         finally:
             os.umask(omask)

--BwCQnh7xodEAoBMC--