zope.sendmail unnecessarily errors out when checking async directories

Bug #602965 reported by Elizabeth Leddy
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Plone
Confirmed
Unknown
Zope 2
Invalid
Low
Unassigned
zope.sendmail
Invalid
Undecided
Unassigned

Bug Description

Noticed when testing plone 4 beta 5, which uses zope 2.12.7, which looks to be zope.sendmail 3.5.1. Reviewing the changeset it doesn't look like this bug has been addressed but if so I apologize for double reporting.

For async queuing, if you select a default directory that already exists, i.e. /tmp (which is the default), and try to save the changes in the ZMI, the following error throws:

Traceback (innermost last):
  Module ZPublisher.Publish, line 127, in publish
  Module ZPublisher.mapply, line 77, in mapply
  Module ZPublisher.Publish, line 47, in call_object
  Module Products.MailHost.MailHost, line 187, in manage_makeChanges
  Module Products.MailHost.decorator, line 26, in method
  Module Products.MailHost.MailHost, line 298, in _startQueueProcessorThread
  Module zope.sendmail.delivery, line 229, in setQueuePath
  Module zope.sendmail.maildir, line 59, in __init__
ValueError: /tmp is not a Maildir folder

Digging in maildir.py, this looks like a simple fix on logic - if the base directory already exists it doesn't create the required subfolders, however it errors on the check for them:
    def __init__(self, path, create=False):
        ...
        if create and not access(path):
            os.mkdir(path)
            os.mkdir(subdir_cur)
            os.mkdir(subdir_new)
            os.mkdir(subdir_tmp)
            maildir = True
        else:
            maildir = (os.path.isdir(subdir_cur) and os.path.isdir(subdir_new)
                       and os.path.isdir(subdir_tmp))
        if not maildir:
            raise ValueError('%s is not a Maildir folder' % path)
       ....

On a somewhat related note, the names of those subfolders are extra generic and there is a potential that if people were to put that in /tmp as suggested, they would either get clobbered or accidentally deleted. This could be easily fixed with the fix + a better default.

Changed in plone:
status: Unknown → Confirmed
Changed in zope2:
importance: Undecided → Low
status: New → Confirmed
Revision history for this message
Colin Watson (cjwatson) wrote :

The zope.sendmail project on Launchpad has been archived at the request of the Zope developers (see https://answers.launchpad.net/launchpad/+question/683589 and https://answers.launchpad.net/launchpad/+question/685285). If this bug is still relevant, please refile it at https://github.com/zopefoundation/zope.sendmail.

Changed in zope.sendmail:
status: New → Invalid
Revision history for this message
Colin Watson (cjwatson) wrote :

The zope2 project on Launchpad has been archived at the request of the Zope developers (see https://answers.launchpad.net/launchpad/+question/683589 and https://answers.launchpad.net/launchpad/+question/685285). If this bug is still relevant, please refile it at https://github.com/zopefoundation/zope2.

Changed in zope2:
status: Confirmed → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.