[Mailman-Users] more prune_arch errors

Mark Sapiro mark at msapiro.net
Thu Sep 27 03:52:13 CEST 2012

Con Wieland wrote:

>The mbox variable changed seemed to take care of that error.

Actually, it didn't. That change was totally wrong, my bad.

>Now after running for about 4 hours I get this
> ./prune_arch -l mgsa-l -d 1095 -bpnv
>Traceback (most recent call last):
>  File "./prune_arch", line 191, in ?
>    main()
>  File "./prune_arch", line 173, in main
>    os.umask(omask)
>UnboundLocalError: local variable 'omask' referenced before assignment

I think it ran for 4 hours because the list was left locked by the
previous failure and at least part of that time, it was waiting for
the list lock to expire. I don't know how that would have happened
though because the list should have been unlocked in the finally:
clause of the try: in which the error occurred.

The above error is because of the incorrect change of line 144 from

            mbox = Mailbox.Mailbox(mboxf)


            mbox = Mailbox.mbox(mboxf)

This threw an exception because of the erroneous change.

I have changed the script again to move the

        omask = os.umask(2)

line ahead of the try: finally: to protect against the above error and
to restore the

            mbox = Mailbox.Mailbox(mboxf)


I also added a test for an unparseable message being returned as a null
string by Mailman's Mailbox class which was the cause of the

    mdate = msg['date'] and mktime_tz(parsedate_tz(msg['date']))
TypeError: string indices must be integers


The current script is at <http://www.msapiro.net/scripts/prune_arch>
and <http://fog.ccsf.cc.ca.us/~msapiro/scripts/prune_arch>.

See the FAQ at <http://wiki.list.org/x/noA9> and remove the stale locks
for the mgsa-l list.

Then, before running prune_arch again, try checking the
archives/private/mgsa-l.mbox/mgsa-l.mbox file for unescaped From_
lines with bin/cleanarch and fix any problems.

This may or may not fix the unparseable message issue, but now the
script should just report it and continue.

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

More information about the Mailman-Users mailing list