[Mailman-Developers] Hacking pipermail...

Mark Sapiro msapiro at value.net
Sat Feb 5 23:49:04 CET 2005


Brad Knowles wrote:
>
>	I've just had to rebuild an archive for a list, thus causing 
>pipermail to regenerate message numbers and breaking all the links 
>that previously used to work.  I'd like to try to figure out a way to 
>avoid that problem.
>
>	Looking at pipermail.py in processUnixMailbox, around lines 
>565-568, the critical code appears to be:
>
>             msgid = m.get('message-id', 'n/a')
>             self.message(_('#%(counter)05d %(msgid)s'))
>             a = self._makeArticle(m, self.sequence)
>             self.sequence += 1
>
>	Am I missing something here?  Could we simply rip out the 
>references to "self.sequence" and instead drop in a call to "md5(m)"? 
>Of course, we'd also have to adjust the initialization of "sequence" 
>to be the empty string and make sure that all other references to it 
>are as a string instead of a number, but I don't think that would be 
>too hard.
>
>	Certainly, it seems that this would be an easy way to avoid 
>having to break all existing links because the sequence number 
>arbitrarily changed when the archive was regenerated.

This is not a comment on Brad's suggested hack which I actually think
is a good idea which can save much grief. Rather, this is an attempt
to suggest a recovery from the immediate situation.

In my admitedly limited experience, I have not seen message sequence
numbers "arbitrarily" changed. Sequence numbers are assigned to
messages in the order that they are read from the mbox file(s). Thus
the only times they change is if:

1)messages are added to or deleted from the mbox files which can be
avoided by only adding to the end of the last (current) mbox if
necessary and just deleting most of the body and perhaps changing the
subject instead of totally deleting the messages. There is a caveat
about deleting messages in
http://www.python.org/cgi-bin/faqw-mm.py?req=show&file=faq03.003.htp

2)there is more than one mbox file and they are not processed in the
original sequence.

3)there is more than one mbox file and when the archive was last built,
the current listname.mbox/listname.mbox file was not processed last.

Note that even case 3 can be recovered by removing the messages that
existed when the archive was last rebuilt and putting them in a
separate mbox which is processed in the original sequence and leaving
the recent messages in the listname.mbox/listname.mbox file and
processing it last.

--
Mark Sapiro <msapiro at value.net>       The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan



More information about the Mailman-Developers mailing list