[Mailman-Users] Error on email confirmations on 2.1.5

Mark Sapiro msapiro at value.net
Thu Jun 30 16:41:12 CEST 2005


Glenn Sieb wrote:

>Nope. I install from source, with the htdig/archiver patches. My confirm 
>script is 89 lines long (with comments).

The fact remains that your confirm script is not the one from the 2.1.5
source distribution. The diff is as follows and it is not from either
htdig-2.1.5-0.1.patch or indexing-2.1.5-0.1.patch.

--- mailman-2.1.5/scripts/confirm       2002-03-13 22:04:08.000000000
-0800
+++ confirm     2005-06-30 07:28:04.875000000 -0700
@@ -24,29 +24,44 @@
 Errors are redirected to logs/errors.
 """

+# Set the default exit status to be used  with the following
+# variable. This is the value which will be used in the event of
+# our not even being able to import modules and do things in a
+# controlled way.
+# The installed default is 75 = MailExits.mailexits.EX_TEMPFAIL
+# This should tell Sendmail to keep keep the mail locally and
+# try again. This should give us time to try and fix the gross
+# installation problem without losing or rejecting all the mail
+# which is arriving.
+DEFAULT_EXIT_STATUS = 75
+# If we cannot import sys then we aren't going to control what
+# sendmail does with the mail
 import sys
+try:
+    import paths
+    from Mailman import MailExits
+    from Mailman import mm_cfg
+    DEFAULT_EXIT_STATUS = mm_cfg.DEFAULT_MAILER_EXIT_STATUS
+    from Mailman.Logging.Utils import LogStdErr
+    LogStdErr('error', 'confirm', tee_to_real_stderr=0)
+    import traceback

-import paths
-from Mailman import mm_cfg
-from Mailman import Utils
-from Mailman.i18n import _
-from Mailman.Queue.sbcache import get_switchboard
-from Mailman.Logging.Utils import LogStdErr
-
-LogStdErr('error', 'confirm')
-
+    try:
+        from Mailman import Utils
+        from Mailman.i18n import _
+        from Mailman.Queue.sbcache import get_switchboard

 ?
-def main():
+        def main():
     try:
         listname = sys.argv[1]
     except IndexError:
-        print >> sys.stderr, _('confirm script got no listname.')
-        sys.exit(1)
+                print >> sys.stderr, _('got no listname.')
+                sys.exit(MailExits.mailexits.EX_TEMPFAIL)
     # Make sure the list exists
     if not Utils.list_exists(listname):
-        print >> sys.stderr, _('confirm script, list not found:
%(listname)s')
-        sys.exit(1)
+                print >> sys.stderr, _('list not found: %(listname)s')
+                sys.exit(MailExits.mailexits.EX_NOUSER)
     # Immediately queue the message for the bounce/cmd qrunner to
process.
     # The advantage to this approach is that messages should never get
lost --
     # some MTAs have a hard limit to the time a filter prog can run. 
Postfix
@@ -57,6 +72,18 @@
                  _plaintext=1)


-?
-if __name__ == '__main__':
+        if __name__ == '__main__':
     main()
+
+    except SystemExit:
+        raise
+    except StandardError:
+        sys.stderr.write("unexpected error handling: %s" %
str(sys.argv))
+        traceback.print_exc(None, sys.stderr)
+        sys.exit(DEFAULT_EXIT_STATUS)
+except SystemExit:
+    # we do not want to catch SystemExits
+    raise
+except StandardError:
+    # But for all others take the default exit status
+    sys.exit(DEFAULT_EXIT_STATUS)

--
Mark Sapiro <msapiro at value.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