summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mailman/commands/cli_control.py19
-rw-r--r--src/mailman/docs/NEWS.rst5
2 files changed, 19 insertions, 5 deletions
diff --git a/src/mailman/commands/cli_control.py b/src/mailman/commands/cli_control.py
index 7b0291229..f58005e0f 100644
--- a/src/mailman/commands/cli_control.py
+++ b/src/mailman/commands/cli_control.py
@@ -103,6 +103,19 @@ class Start:
def log(message):
if not args.quiet:
print(message)
+ # Try to find the path to a valid, existing configuration file, and
+ # refuse to start if one cannot be found.
+ if args.config is not None:
+ config_path = args.config
+ elif config.filename is not None:
+ config_path = config.filename
+ else:
+ config_path = os.path.join(config.VAR_DIR, 'etc', 'mailman.cfg')
+ if not os.path.exists(config_path):
+ print(_("""\
+No valid configuration file could be found, so Mailman will refuse to start.
+Use -C/--config to specify a valid configuration file."""), file=sys.stderr)
+ sys.exit(1)
# Daemon process startup according to Stevens, Advanced Programming in
# the UNIX Environment, Chapter 13.
pid = os.fork()
@@ -117,11 +130,7 @@ class Start:
os.setsid()
# Instead of cd'ing to root, cd to the Mailman runtime directory.
# However, before we do that, set an environment variable used by the
- # subprocesses to calculate their path to the $VAR_DIR. Before we
- # chdir() though, calculate the absolute path to the configuration
- # file.
- config_path = (config.filename if args.config is None
- else os.path.abspath(args.config))
+ # subprocesses to calculate their path to the $VAR_DIR.
os.environ['MAILMAN_VAR_DIR'] = config.VAR_DIR
os.chdir(config.VAR_DIR)
# Exec the master watcher.
diff --git a/src/mailman/docs/NEWS.rst b/src/mailman/docs/NEWS.rst
index 8ac98d507..62162280f 100644
--- a/src/mailman/docs/NEWS.rst
+++ b/src/mailman/docs/NEWS.rst
@@ -12,6 +12,11 @@ Here is a history of user visible changes to Mailman.
===============================
(2015-XX-XX)
+Bugs
+----
+ * Fix calculation of default configuration file to use when the ``$var_dir``
+ is created by ``mailman start``. (LP: #1411435)
+
Configuration
-------------
* When specifying a file system path in the [paths.*] section, $cfg_file can