[New-bugs-announce] [issue7359] mailbox cannot modify mailboxes in system mail spool

Matthias Klose report at bugs.python.org
Thu Nov 19 17:15:26 CET 2009


New submission from Matthias Klose <doko at debian.org>:

no change in behaviour in 2.6

the mailbox module in python 2.5 cannot modify mboxes in read-only
directories, e.g. the system mail spool.  This is because
mailbox._singlefileMailbox.flush() tries to write the modified mailbox
to a temporary file and then rename it.  See: 

penelope[tmp]$ python2.5
Python 2.5 (release25-maint, Dec  9 2006, 14:35:53) 
[GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-20)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import mailbox
>>> mbox = mailbox.mbox("/var/mail/nikolaus")
>>> mbox.clear()
>>> mbox.close()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.5/mailbox.py", line 623, in close
    self.flush()
  File "/usr/lib/python2.5/mailbox.py", line 570, in flush
    new_file = _create_temporary(self._path)
  File "/usr/lib/python2.5/mailbox.py", line 1885, in _create_temporary
    os.getpid()))
  File "/usr/lib/python2.5/mailbox.py", line 1875, in _create_carefully
    fd = os.open(path, os.O_CREAT | os.O_EXCL | os.O_RDWR)
OSError: [Errno 13] Permission denied:
'/tmp/mail/nikolaus.1195061622.penelope.4241'
>>>

----------
components: Library (Lib)
messages: 95486
nosy: doko
severity: normal
status: open
title: mailbox cannot modify mailboxes in system mail spool
type: feature request

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7359>
_______________________________________


More information about the New-bugs-announce mailing list