[ OpenInfo Home ] [ UP ]

Mailman Patch #644797: Revised mailer exit status


This patch modifies the Python scripts in $prefix/scripts/ that are used by the MTA to deliver incoming mail to Mailman.

The exit statuses now returned are drawn from the mail related values defined in /usr/include/sysexits.h

This allows the MTA to return more meaningful responses to the sender when rejecting mail. It also allows a more sympathetic treatment of mail in the event that the Python script suffers an unexpected exception when handling incoming email.

Such exceptions are now logged to MM's $prefix/logs/error in all but the most extreme error cases and the internal information about the Python exception is not passed into the response to the sender.


Versions of this patch are avaliable for Mailman version 2.0.13, 2.1 final and later.

Necessary Precursors


Changes Made

A new module Mailman/MailExits is added. Within this module is defined a dictionary - mailexits - whose keys are the strings #define'd in /usr/include/sysexits.h with values again being those from the definition in /usr/include/sysexits.h.

Note that the exit codes defined by Mailman/MailExits are now available in the os module of Python version 2.3 and later. When Mailman is run using Python 2.3 the Mailman/MailExits module uses the exit codes definitions from the Python os module.

The main code of all the scripts installed in $prefix/scripts, which are called by the MTA to deliver mail to Mailman, is wrapped in a try with an associated exception handler. If possible the exception handler logs any failure of the main script code to Mailman's $prefix/logs/error log and does a controlled exit. In all but the most extreme forms of code failure the exit status reported defaults to EX_TEMPFAIL (75) but this can be set in $prefix/Mailman/mm_cfg.py using the DEFAULT_MAILER_EXIT_STATUS configuration variable. If the main code of the script uses the sys.exit function then exit status it reports is returned.

Applying the patch

Apply the patch from within the Mailman build directory using the command:

    patch -p1 < path-to-patch-file

Download Patch File

MM Version Download
2.1.12 Download
2.1.11 Download
2.1.10 Download
2.1.9 Download
Uses the same patch as MM 2.1.7
2.1.8 Download
Uses the same patch as MM 2.1.7
2.1.7 Download
2.1.6 Download
2.1.4 Uses the same patch as MM 2.1.3
2.1.3 Download
2.1.2 Download
2.1.1 Uses the same patch as MM 2.1
2.1 final Download
2.0.13 Download

Click to e-mail comments or complaints Last updated: 09/07/2009 13:47

[ OpenInfo Home ] [ UP ]