Bug 225961 - mail/mailman: Improper test for "localhost" in rc.d script + ambiguous error message
Summary: mail/mailman: Improper test for "localhost" in rc.d script + ambiguous error ...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Matthias Andree
Depends on:
Reported: 2018-02-16 21:34 UTC by Terry Kennedy
Modified: 2018-02-17 12:46 UTC (History)
1 user (show)

See Also:
mandree: maintainer-feedback+

Config file, with hostname changed to example.com (155 bytes, text/plain)
2018-02-16 21:34 UTC, Terry Kennedy
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Terry Kennedy 2018-02-16 21:34:27 UTC
Created attachment 190704 [details]
Config file, with hostname changed to example.com

I updated one of my systems to r361539 and a check added in r461277 appears to be checking for "localhost" in mm_cfg.py and finding it, despite it not being defined. This leads to a very ambiguous error message, "Start of mailman refused due to insufficient configuration."

My mm_cfg.py is attached, in sanitized form.
Comment 1 Matthias Andree freebsd_committer 2018-02-16 23:09:14 UTC
Sorry, this is a side-effect of a cleanup that prevents checksum mismatches on the Defaults.py file, and the solution is documented in UPDATING 20180208.
Comment 2 Matthias Andree freebsd_committer 2018-02-16 23:14:57 UTC
To fill in a bit of detail, there have been three phases of Mailman behaviour:

- older versions filled in the BUILD host name, causing very strange mail bounce behaviour in your configuration

- not so old versions before the 2.1.26 update would write the installation host's name into Defaults.py from post-install, breaking the pkg checksum on every installation.

- recent mailman versions just hardwire localhost, which is what two Linux distributions are doing (Fedora and Arch Linux), and since that is even more confusing, the rcfile catches this.

  AFFECTS: users of mail/mailman*
  AUTHOR: mandree@FreeBSD.org

  In order to overcome complaints about mismatched checksums in
  Mailman/Default.py, mailman now configures the DEFAULT_EMAIL_HOST
  and DEFAULT_URL_HOST to "localhost" statically, and the rc script
  will check this and refuse to start on next boot.

  Users must configure DEFAULT_EMAIL_HOST and DEFAULT_URL_HOST in 
  Mailman/mm_cfg.py properly.

  A short example has been added to:

where the latter contains:

   In most cases, you will want to override the host name settings (which
   default to 'localhost') by adding these lines to Mailman/mm_cfg.py:
   (the documentation is in Mailman/Defaults.py, but you need to override
   the defaults in mm_cfg.py instead, changes to Defaults.py are lost on

   # adjust and add this to Mailman/mm_cfg.py:
   DEFAULT_URL_HOST = 'CHANGE_ME.example.org'

If you have a good proposal that works for source/ports installation as well as binary package installation, that avoids the checksum failures that arose from tampering with Defaults.py/.pyc from the post-install script, and that is robust without tampering with user configurations, I shall be very happy to hear about that, in that case, please reopen this report with a solution or best a tested patch.
Comment 3 Terry Kennedy 2018-02-16 23:32:41 UTC
[Revised due to your intervening reply.]

There is a very subtle interaction going on. Defaults.py already contains:

Therefore, I did not change it in mm_cfg.py. However, that is apparently evaluated before the definitions of DEFAULT_URL_HOST and DEFAULT_EMAIL_HOST in mm_cfg.py.

Setting DEFAULT_URL_HOST and DEFAULT_EMAIL_HOST in mm_cfg.py is not sufficient - add_virtualhost(DEFAULT_URL_HOST, DEFAULT_EMAIL_HOST) is also needed.

I suggest 2 changes:

1) Revise UPDATING to inclue add_virtualhost to the required contents of mm_cfg.py.

2) Revise the wording of the error "Start of mailman refused due to insufficient configuration." with something like "DEFAULT_EMAIL_HOST,  DEFAULT_URL_HOST and add_virtualhost must be set in Mailman/mm_cfg.py"?
Comment 4 Terry Kennedy 2018-02-16 23:34:28 UTC
Per my previous reply, re-opening.
Comment 5 Matthias Andree freebsd_committer 2018-02-17 12:45:36 UTC
Indeed, and I have had other ideas how to solve this for the common cases.
Comment 6 commit-hook freebsd_committer 2018-02-17 12:46:17 UTC
A commit references this bug:

Author: mandree
Date: Sat Feb 17 12:45:19 UTC 2018
New revision: 462151
URL: https://svnweb.freebsd.org/changeset/ports/462151

  Overhaul default hosts configuration.

  - When no virtualhosts are defined, and the default localhost/localhost is
    effective, the post-install script now adds DEFAULT_EMAIL_HOST,
    DEFAULT_URL_HOST, and add_virtualhost() lines to mm_cfg.py.

    Add corresponding support to remove unchanged configurations to the
    deinstall script.

  - While here, overhaul crontab configuration to only request a merge if the
    crontab had been modified, and unify progress reports.

  - Merge pkg-deinstall into pkg-install, to avoid duplication of code
    that might be missed in later maintenance.

  PR:		225961
  Reported by:	Terry Kennedy