[Mailman-Users] Thanks -

Barry A. Warsaw bwarsaw at cnri.reston.va.us
Sun Mar 21 21:30:31 CET 1999


>>>>> "paz" ==   <paz at apriori.net> writes:

    paz> If anyone can heads or tails of that, particularly if it's of
    paz> any real concern to me, I'd appreciate knowing.

Looks like your config.db file is corrupt.  Here's a script I just
added to the system that can give a little more information about
what's going on.

-Barry

-------------------- snip snip --------------------
#! /usr/bin/env python

"""Check the raw config.db for a mailing list.
Also check the config.db.last if the live file is corrupted.

Usage: %(program)s listname
"""

import sys
import os
import marshal
import paths
import Mailman.mm_cfg

program = sys.argv[0]

def testfile(filename):
    try:
        fp = open(filename)
    except IOError, (code, msg):
        print filename, 'cannot be opened:\n\t', msg
        return 1
    else:
        try:
            d = marshal.load(fp)
        except (EOFError, ValueError, TypeError), msg:
            print filename, 'is corrupted:\n\t', msg
            return 1
        else:
            print filename, 'is fine'
            return 0


def main():
    if len(sys.argv) == 2:
        listname = sys.argv[1]
    else:
        print __doc__ % globals()
        sys.exit(1)

    listpath = os.path.join(Mailman.mm_cfg.LIST_DATA_DIR, listname)
    configdb = os.path.join(listpath, 'config.db')
    lastdb = os.path.join(listpath, 'config.db.last')

    origbad = testfile(configdb)
    backupbad = testfile(lastdb)

    if origbad and not backupbad:
        print """
***** ALERT *****
The original database file is corrupt, but the backup seems fine.
Consider copying
    %(lastdb)s
to
    %(configdb)s
however, you may lose some data.""" % locals()
    elif origbad and backupbad:
        print """
***** ALERT *****
Both the original database file and the backup seem
corrupted.  You will probably need to recover both
    %(configdb)s
and
    %(lastdb)s
from a system backup, or remove the list `%(listname)s' and
re-create it from scratch.""" % locals()
        

if __name__ == '__main__':
    main()




More information about the Mailman-Users mailing list