aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbwarsaw <>2005-05-31 22:38:44 +0000
committerbwarsaw <>2005-05-31 22:38:44 +0000
commitbbd4546fe4a28fbc3ca49e60f06fe4ca5b6a2064 (patch)
treef7471ffae534e7a546b152a7e4ca612763b646d9
parent5683ee8e11b9d161708260ddae0a527796e9f11b (diff)
downloadmailman2-bbd4546fe4a28fbc3ca49e60f06fe4ca5b6a2064.tar.gz
mailman2-bbd4546fe4a28fbc3ca49e60f06fe4ca5b6a2064.tar.xz
mailman2-bbd4546fe4a28fbc3ca49e60f06fe4ca5b6a2064.zip
Fixes for SF #949117.
update_qfiles(): Catch and ignore OSErrors when trying to listdir() a non-directory. dequeue(): Catch EOFErrors that can occur if a zero-length qfile is encountered.
-rwxr-xr-xbin/update31
1 files changed, 20 insertions, 11 deletions
diff --git a/bin/update b/bin/update
index 3ecc304f..0c54fa2a 100755
--- a/bin/update
+++ b/bin/update
@@ -1,6 +1,6 @@
#! @PYTHON@
#
-# Copyright (C) 1998-2004 by the Free Software Foundation, Inc.
+# Copyright (C) 1998-2005 by the Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -431,16 +431,21 @@ def update_qfiles():
# The files in qfiles/bad can't possibly be pickles
continue
sb = Switchboard(dirpath)
- for filename in os.listdir(dirpath):
- filepath = os.path.join(dirpath, filename)
- filebase, ext = os.path.splitext(filepath)
- # Handle the .db metadata files as part of the handling of the
- # .pck or .msg message files.
- if ext not in ('.pck', '.msg'):
- continue
- msg, data = dequeue(filebase)
- if msg is not None and data is not None:
- sb.enqueue(msg, data)
+ try:
+ for filename in os.listdir(dirpath):
+ filepath = os.path.join(dirpath, filename)
+ filebase, ext = os.path.splitext(filepath)
+ # Handle the .db metadata files as part of the handling of the
+ # .pck or .msg message files.
+ if ext not in ('.pck', '.msg'):
+ continue
+ msg, data = dequeue(filebase)
+ if msg is not None and data is not None:
+ sb.enqueue(msg, data)
+ except EnvironmentError, e:
+ if e.errno <> errno.ENOTDIR:
+ raise
+ print _('Warning! Not a directory: %(dirpath)s')
@@ -521,6 +526,10 @@ def dequeue(filebase):
else:
os.unlink(msgfile)
msg = data = None
+ except EOFError:
+ # For some reason the pckfile was empty. Just delete it.
+ print _('Warning! Deleting empty .pck file: %(pckfile)s')
+ os.unlink(pckfile)
finally:
if msgfp:
msgfp.close()