Update of /cvsroot/mailman/mailman/bin
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23735

Modified Files:
      Tag: Release_2_1-maint
        update 
Log Message:
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.


Index: update
===================================================================
RCS file: /cvsroot/mailman/mailman/bin/update,v
retrieving revision 2.22.2.6
retrieving revision 2.22.2.7
diff -u -d -r2.22.2.6 -r2.22.2.7
--- update      24 Apr 2004 12:25:57 -0000      2.22.2.6
+++ update      31 May 2005 22:38:44 -0000      2.22.2.7
@@ -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 @@
             # 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 @@
                 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()

_______________________________________________
Mailman-checkins mailing list
[email protected]
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org

Reply via email to