command mailman info fails when Database url does not exist

Bug #543620 reported by Patrick Ben Koetter
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
GNU Mailman
Status tracked in 3.0
3.0
Undecided
Barry Warsaw

Bug Description

The command "mailman info" crashes if the database path "url" points to a location that does not exist yet:

root@mailman:~/mailman/bin# ./mailman info
Traceback (most recent call last):
  File "./mailman", line 32, in <module>
    mailman.bin.mailman.main()
  File "/root/mailman/src/mailman/bin/mailman.py", line 98, in main
    initialize(config_file)
  File "/root/mailman/src/mailman/core/initialize.py", line 175, in initialize
    initialize_2(propagate_logs=propagate_logs)
  File "/root/mailman/src/mailman/core/initialize.py", line 146, in initialize_2
    database.initialize(debug)
  File "/root/mailman/src/mailman/database/stock.py", line 64, in initialize
    self._create(debug)
  File "/root/mailman/src/mailman/database/stock.py", line 98, in _create
    touch(url)
  File "/root/mailman/src/mailman/database/stock.py", line 141, in touch
    fd = os.open(path, os.O_WRONLY | os.O_NONBLOCK | os.O_CREAT, 0666)
OSError: [Errno 2] No such file or directory: '/opt/mailman/data/mailman.db'

Barry Warsaw (barry)
Changed in mailman:
milestone: none → 3.0.0a6
Revision history for this message
Barry Warsaw (barry) wrote :

Can you post your mailman.cfg file? 'bin/mailman info' will try to create the mailman.db file if it doesn't exist, but of course that could fail if say the process doesn't have permission to create the paths, e.g.

-----mailman.cfg-----
[mailman]
layout: foo

[paths.foo]
var_dir: /foo/mailman
----------

% bin/mailman info
Traceback (most recent call last):
  File "bin/mailman", line 31, in <module>
    mailman.bin.mailman.main()
  File "/home/barry/projects/mailman/3.0/src/mailman/bin/mailman.py", line 98, in main
    initialize(config_file)
  File "/home/barry/projects/mailman/3.0/src/mailman/core/initialize.py", line 174, in initialize
    initialize_1(config_path)
  File "/home/barry/projects/mailman/3.0/src/mailman/core/initialize.py", line 117, in initialize_1
    mailman.config.config.load(config_path)
  File "/home/barry/projects/mailman/3.0/src/mailman/config/config.py", line 106, in load
    self._post_process()
  File "/home/barry/projects/mailman/3.0/src/mailman/config/config.py", line 126, in _post_process
    Switchboard.initialize()
  File "/home/barry/projects/mailman/3.0/src/mailman/queue/__init__.py", line 94, in initialize
    config.switchboards[name] = Switchboard(name, path)
  File "/home/barry/projects/mailman/3.0/src/mailman/queue/__init__.py", line 119, in __init__
    makedirs(self.queue_directory, 0770)
  File "/home/barry/projects/mailman/3.0/src/mailman/utilities/filesystem.py", line 66, in makedirs
    os.makedirs(path, mode)
  File "/usr/lib/python2.6/os.py", line 150, in makedirs
    makedirs(head, mode)
  File "/usr/lib/python2.6/os.py", line 150, in makedirs
    makedirs(head, mode)
  File "/usr/lib/python2.6/os.py", line 150, in makedirs
    makedirs(head, mode)
  File "/usr/lib/python2.6/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/foo'

Barry Warsaw (barry)
Changed in mailman:
assignee: nobody → Barry Warsaw (barry)
status: New → Incomplete
tags: added: mailman3
removed: 3.0 mailman
Revision history for this message
Patrick Ben Koetter (p-state-of-mind) wrote :

When the error occured /opt/mailman existed AND /etc/mailman.cfg used to be like this:

p@mailman:~$ cat /etc/mailman.cfg
[mailman]
site_owner: <email address hidden>

# Which paths.* file system layout to use.
layout: dev

[paths.master]
var_dir: /opt/mailman

# [database]
# The class implementing the IDatabase.
# class: mailman.database.stock.StockDatabase

# Use this to set the Storm database engine URL. You generally have one
# primary database connection for all of Mailman. List data and most rosters
# will store their data in this database, although external rosters may access
# other databases in their own way. This string supports standard
# 'configuration' substitutions.
# url: sqlite:///opt/mailman/data/mailman.db
# debug: no

Revision history for this message
Barry Warsaw (barry) wrote :

I just noticed a problem with the mailman.cfg file you posted. You've set the layout to be 'dev' but you're overriding var_dir in the [paths.master] section. That doesn't match, so it's not picking that up. You can verify by running

bin/mailman info -p

See if

s/paths.master/paths.dev/

fixes your problem.

Revision history for this message
Barry Warsaw (barry) wrote :

BTW I am going to change 'bin/mailman info --paths/-p' to '--verbose/-v' in the trunk ;)

Revision history for this message
Patrick Ben Koetter (p-state-of-mind) wrote : Re: [Bug 543620] Re: command mailman info fails when Database url does not exist

* Barry Warsaw <email address hidden>:
> I just noticed a problem with the mailman.cfg file you posted. You've
> set the layout to be 'dev' but you're overriding var_dir in the
> [paths.master] section. That doesn't match, so it's not picking that
> up. You can verify by running
>
> bin/mailman info -p
>
> See if
>
> s/paths.master/paths.dev/
>
> fixes your problem.

I noticed that too when I posted the config to you. The problem probably is -
which is good in this case - that I am not an experienced python user nor
developer and the relation between the two didn't strike me.

I think I've even looked for a correlation in the original
mailman/../mailman.cfg and didn't find one.

Anyway. I will change it and see what happens.

p@rick

>
> --
> command mailman info fails when Database url does not exist
> https://bugs.launchpad.net/bugs/543620
> You received this bug notification because you are a direct subscriber
> of the bug.
>
> Status in GNU Mailman: Incomplete
> Status in GNU Mailman 3.0 series: Incomplete
>
> Bug description:
> The command "mailman info" crashes if the database path "url" points to a location that does not exist yet:
>
> root@mailman:~/mailman/bin# ./mailman info
> Traceback (most recent call last):
> File "./mailman", line 32, in <module>
> mailman.bin.mailman.main()
> File "/root/mailman/src/mailman/bin/mailman.py", line 98, in main
> initialize(config_file)
> File "/root/mailman/src/mailman/core/initialize.py", line 175, in initialize
> initialize_2(propagate_logs=propagate_logs)
> File "/root/mailman/src/mailman/core/initialize.py", line 146, in initialize_2
> database.initialize(debug)
> File "/root/mailman/src/mailman/database/stock.py", line 64, in initialize
> self._create(debug)
> File "/root/mailman/src/mailman/database/stock.py", line 98, in _create
> touch(url)
> File "/root/mailman/src/mailman/database/stock.py", line 141, in touch
> fd = os.open(path, os.O_WRONLY | os.O_NONBLOCK | os.O_CREAT, 0666)
> OSError: [Errno 2] No such file or directory: '/opt/mailman/data/mailman.db'
>
> To unsubscribe from this bug, go to:
> https://bugs.launchpad.net/mailman/+bug/543620/+subscribe

--
state of mind
Digitale Kommunikation

http://www.state-of-mind.de

Franziskanerstraße 15 Telefon +49 89 3090 4664
81669 München Telefax +49 89 3090 4666

Amtsgericht München Partnerschaftsregister PR 563

Revision history for this message
Barry Warsaw (barry) wrote :

Cool, let me know. I do think we could use better documentation for the configuration options. ;/

Revision history for this message
Patrick Ben Koetter (p-state-of-mind) wrote :

* Barry Warsaw <email address hidden>:
> I just noticed a problem with the mailman.cfg file you posted. You've
> set the layout to be 'dev' but you're overriding var_dir in the
> [paths.master] section. That doesn't match, so it's not picking that
> up. You can verify by running
>
> bin/mailman info -p
>
> See if
>
> s/paths.master/paths.dev/
>
> fixes your problem.

It fixed the problem.

p@rick

--
state of mind
Digitale Kommunikation

http://www.state-of-mind.de

Franziskanerstraße 15 Telefon +49 89 3090 4664
81669 München Telefax +49 89 3090 4666

Amtsgericht München Partnerschaftsregister PR 563

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers