Subject: Bug#440162: newlist: emailhost should default to urlhost if specified

From: martin f krafft <[email-masked]>
Date: Thu, 30 Aug 2007 12:44:41 +0200

Package: mailman
Version: 2.1.9-7
Severity: wishlist
Tags: patch

When I call newlist, emailhost is set to mm_cfg.DEFAULT_EMAIL_HOST,
unless --urlhost is specified and maps to a value in the
VIRTUAL_HOSTS map.

From all I can tell, this behaviour doesn't really make sense. If
--urlhost is specified and the key is not found in VIRTUAL_HOSTS,
then it should default to urlhost, not to mm_cfg.DEFAULT_EMAIL_HOST.

Here is what I think should happen, given defaults of lists.bar.com for
urlhost/emailhost; this is newlist just printing urlhost, emailhost:

$ newlist -q list1 [email-masked] password
lists.bar.com lists.bar.com
$ newlist -q -u baz.bar.com list1 [email-masked] password
baz.bar.com baz.bar.com
$ newlist -q -u baz.bar.com -e mail.bar.com list1 [email-masked] password
baz.bar.com mail.bar.com
$ newlist -q -e mail.bar.com list1 [email-masked] password
lists.bar.com mail.bar.com
$ newlist -q [email-masked] [email-masked] password
baz.bar.com baz.bar.com
$ sudo newlist -q [email-masked] [email-masked] password
lists.bar.com lists.bar.com
$ sudo newlist -q [email-masked] [email-masked] password  
baz.bar.com baz.bar.com

Now, with add_virtualhost('www.foo.bar.com', 'foo.bar.com'):

$ sudo newlist -q [email-masked] [email-masked] password  
www.foo.bar.com foo.bar.com
$ sudo newlist -q -u www.bar.com [email-masked] [email-masked] password 
www.bar.com foo.bar.com
$ sudo newlist -q -e mail.bar.com [email-masked] [email-masked] password 
www.foo.bar.com mail.bar.com
$ sudo newlist -q -u www.bar.com -e mail.bar.com [email-masked] [email-masked] password                                                     
www.bar.com mail.bar.com

PS: I think instead of urlhost mapping to emailhost, it should be
exactly the other way around; mailman is primarily a mail list
manager, not a web interface after all.

Here's the patch:

--- /tmp/newlist        2007-08-30 12:44:25.867885279 +0200
+++ /usr/sbin/newlist   2007-08-30 12:43:45.563486360 +0200
@@ -170,7 +170,8 @@
 
     urlhost = urlhost or mm_cfg.DEFAULT_URL_HOST
     host_name = emailhost or \
-                mm_cfg.VIRTUAL_HOSTS.get(urlhost, mm_cfg.DEFAULT_EMAIL_HOST)
+                mm_cfg.VIRTUAL_HOSTS.get(urlhost, urlhost)
+    emailhost = host_name
     web_page_url = mm_cfg.DEFAULT_URL_PATTERN % urlhost
 
     if Utils.list_exists(listname):

-- 
 .''`.   martin f. krafft <[email-masked]>
: :'  :  proud Debian developer, author, administrator, and user
`. `'`   http://people.debian.org/~madduck - http://debiansystem.info
  `-  Debian - when you have better things to do than fixing systems