[Mailman-Users] bin/rmlist too bold removing entries from postfix aliases file
Todd
tmz at paonline.com
Thu Jan 2 01:14:41 CET 2003
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi all,
First off, thanks to Barry and all the MM developers for such a fine piece
of software.
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).
I didn't see any mention of this in the list archives, but I could have
missed it. Can anyone else confirm this behavior or am I doing something
wrong?
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. :)
I'm not much of a coder (and even less of a python coder), but I managed to
patch Postfix.py to use a regexp instead of the simpler startswith to make
the match more accurate. File this under WORKSFORME. I'm sure it can be
improved upon, assuming this is really a problem and not a feature or some
mis-usage on my part
Here's the several line diff (let me know if there's a better place to post
this):
###########################################################################
- --- Mailman/MTA/Postfix.py.orig Tue Dec 31 20:53:42 2002
+++ Mailman/MTA/Postfix.py Tue Dec 31 20:48:47 2002
@@ -22,6 +22,7 @@
import errno
import pwd
import grp
+import re
from stat import *
from Mailman import mm_cfg
@@ -248,8 +249,8 @@
finally:
os.umask(omask)
filteroutp = 0
- - start = '# STANZA START: ' + listname
- - end = '# STANZA END: ' + listname
+ start = re.compile('^# STANZA START: ' + listname + ' *$')
+ end = re.compile('^# STANZA END: ' + listname + ' *$')
while 1:
line = infp.readline()
if not line:
@@ -259,14 +260,14 @@
# filtering out a stanza, we're just looking for the proper begin
# marker.
if filteroutp:
- - if line.startswith(end):
+ if end.search(line):
filteroutp = 0
# Discard the trailing blank line, but don't worry if
# we're at the end of the file.
infp.readline()
# Otherwise, ignore the line
else:
- - if line.startswith(start):
+ if start.search(line):
# Filter out this stanza
filteroutp = 1
else:
###########################################################################
Thanks,
- --
Todd OpenPGP -> KeyID: 0xD654075A | URL: www.pobox.com/~tmz
============================================================================
Liberty is always dangerous, but it is the safest thing we have.
-- Harry Emerson Fosdick
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
Comment: When crypto is outlawed bayl bhgynjf jvyy unir cevinpl.
iD8DBQE+E4Rxuv+09NZUB1oRAsJ+AKCGCAOP7WVboICb/3iBDlzOAs85TACgkX3/
J0TijmI86Puluia21G+E7VM=
=t3kL
-----END PGP SIGNATURE-----
More information about the Mailman-Users
mailing list