GNU Mailman Subscription Confirmation Bug Fix

Written by Geoff Mottram (geoff at minaret dot biz).

Placed in the public domain on February 26, 2005 by the author.

This document is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the author be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with this document or the use or other dealings in this document.

Contents
Introduction
Fixing Mailman

Introduction
This document describes a problem with GNU Mailman version 2.1.5 but probably applies to other versions of the software. There is a separate document that describes the Set Group ID Wrapper error in Mailman 2.1.5 along with a solution.

GNU Mailman is an open source mailing list manager. When a user subscribes to a Mailman mailing list, the list can be configured to send a confirmation email to the user. This extra step prevets users from being subscribed to a list without their knowledge. The confirmation email sent by Mailman gives the user the option to either reply to the email message or use a web page to confirm their subscription.

The web based Mailman confirmation page gives the user the option to subscribe to the list or cancel their subscription request. If the user chooses to cancel their request, Mailman will return a bug page that begins like this:

Bug in Mailman version 2.1.5

We're sorry, we hit a bug!

If you would like to help us identify the problem, please email a copy of this page to the webmaster for this site with a description of what happened. Thanks!

Traceback:

    Traceback (most recent call last):
  File "/usr/local/mailman/scripts/driver", line 87, in run_main
    main()
  File "/usr/local/mailman/Mailman/Cgi/confirm.py", line 114, in main
    subscription_cancel(mlist, doc, cookie)
  File "/usr/local/mailman/Mailman/Cgi/confirm.py", line 312, in subscription_cancel
    userdesc = mlist.pend_confirm(cookie)[1]
  File "/usr/local/mailman/Mailman/Pending.py", line 141, in pend_confirm
    assert self.Locked()
AssertionError

Fixing Mailman
To fix Mailman, you just have to make a small change to a "Python" source file. The file is "Mailman/Cgi/confirm.py" in your Mailman installation directory.

Step by step instructions:

  • Change to the directory where you installed the binary version of Mailman. While you can probably make this fix in the Mailman source code directory, these instructions were written using the installation files.
  • Change to the "Mailman/Cgi" subdirectory of the Mailman installation directory.
  • Edit the file "confirm.py". On or about line 312 is the following:
        userdesc = mlist.pend_confirm(cookie)[1]
    This line will be found in the subscription_cancel() method.
  • Replace this line with the following block of code:
        mlist.Lock()
        try:
            userdesc = mlist.pend_confirm(cookie)[1]
        finally:
            mlist.Unlock()
    Note that Python is very particular about line indentation (lines 1, 2 and 4 in the above code are indented 4 spaces and the other two lines are intended 8 spaces).
  • Save the file.
  • Subscribe to a mailing list on your server and when you get the confirmation email, use the web interface and try to cancel your subscription request. Mailman should return a screen with the following message: "You have canceled your subscription request."
  • Technical Tips