[Mailman-Developers] Patch for HyperArch
Sebastian Hagedorn
Hagedorn at uni-koeln.de
Mon Mar 7 07:00:13 EST 2016
Hi,
we recently needed to rebuild a rather old list archive. The oldest mails
are from 2001, and as far as I could tell the last complete rebuild
happened in 2005. When we ran "arch --wipe" now, it failed:
Aktualisiere HTML f?r Artikel 1412
Schreibe Archivzustand in Datei
/var/lib/mailman/archives/private/linux-users/pipermail.pck
Traceback (most recent call last):
File "./arch", line 201, in <module>
main()
File "./arch", line 189, in main
archiver.processUnixMailbox(fp, start, end)
File "/usr/lib/mailman/Mailman/Archiver/pipermail.py", line 587, in
processUnixMailbox
a = self._makeArticle(m, self.sequence)
File "/usr/lib/mailman/Mailman/Archiver/HyperArch.py", line 688, in
_makeArticle
mlist=self.maillist)
File "/usr/lib/mailman/Mailman/Archiver/HyperArch.py", line 264, in
__init__
self.__super_init(message, sequence, keepHeaders)
File "/usr/lib/mailman/Mailman/Archiver/pipermail.py", line 186, in
__init__
self._set_date(message)
File "/usr/lib/mailman/Mailman/Archiver/HyperArch.py", line 601, in
_set_date
self.fromdate = time.ctime(int(self.date))
ValueError: timestamp out of range for platform time_t
Obviously the mails that caused this error were broken, but a previous
version of arch was able to build the archive regardless. I wrote the
following patch to work around the problem (I wrote it for 2.1.18, but I
checked that the code looks the same in 2.1.21):
--- /service/HyperArch.py 2014-07-16 13:01:11.000000000 +0200
+++ HyperArch.py 2016-03-07 11:25:34.000000000 +0100
@@ -598,7 +598,14 @@
def _set_date(self, message):
self.__super_set_date(message)
- self.fromdate = time.ctime(int(self.date))
+ try:
+ self.fromdate = time.ctime(int(self.date))
+ except ValueError:
+ syslog('error',
+ 'Archive error. Date %s is invalid.',
+ int(self.date))
+ self.date = str(int(time.time()))
+ self.fromdate = time.ctime(int(self.date))
def loadbody_fromHTML(self,fileobj):
self.body = []
If an exception is caught, the date is simply set to the current time.
--
.:.Sebastian Hagedorn - Weyertal 121 (Gebäude 133), Zimmer 2.02.:.
.:.Regionales Rechenzentrum (RRZK).:.
.:.Universität zu Köln / Cologne University - ✆ +49-221-470-89578.:.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/mailman-developers/attachments/20160307/06704ddc/attachment.sig>
More information about the Mailman-Developers
mailing list