[Mailman-Users] bin/rmlist too bold removing entries from postfix aliases file

Jon Parise jon at csh.rit.edu
Thu Jan 2 03:43:58 CET 2003

On Wed, Jan 01, 2003 at 07:14:41PM -0500, Todd wrote:

> I was testing out MM2.1 yesterday and created a few test lists.  I was
> feeling especially creative so I named them test and test2.  When I used
> bin/rmlist to remove "test" I found that it had also deleted the test2
> entries from data/aliases (I use postfix as my MTA).

> It looks like the problem is in Mailman/MTA/Postfix.py's _do_remove().  It
> simply checks that the line startswith '# STANZA START: ' + listname.  This
> matches any lists that start with the same string as another listname.  So
> If I have the lists test, test-users, and test-announce, running 'bin/rmlist
> test' will remove all three lists from data/aliases.  This makes it hard for
> postfix to deliver mail to the list. :)

> Here's the several line diff (let me know if there's a better place to post
> this):
I don't think a regular expression is the correct way to handle this,
but you've definitely identified the problem.  I like the attached
patch a bit better (although Barry has the final say).

Jon Parise (jon at csh.rit.edu)  ::  http://www.csh.rit.edu/~jon/
-------------- next part --------------
Index: Postfix.py
RCS file: /cvsroot/mailman/mailman/Mailman/MTA/Postfix.py,v
retrieving revision 2.18
diff -u -r2.18 Postfix.py
--- Postfix.py	23 Aug 2002 20:32:05 -0000	2.18
+++ Postfix.py	2 Jan 2003 02:41:33 -0000
@@ -259,14 +259,14 @@
             # filtering out a stanza, we're just looking for the proper begin
             # marker.
             if filteroutp:
-                if line.startswith(end):
+                if line.strip() == end:
                     filteroutp = 0
                     # Discard the trailing blank line, but don't worry if
                     # we're at the end of the file.
                 # Otherwise, ignore the line
-                if line.startswith(start):
+                if line.strip() == start:
                     # Filter out this stanza
                     filteroutp = 1

More information about the Mailman-Users mailing list