Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Bugs

[issue7359] mailbox cannot modify mailboxes in system mail spool

 

 

Python bugs RSS feed   Index | Next | Previous | View Threaded


report at bugs

Nov 19, 2009, 8:15 AM

Post #1 of 2 (129 views)
Permalink
[issue7359] mailbox cannot modify mailboxes in system mail spool

New submission from Matthias Klose <doko [at] debian>:

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>
<http://bugs.python.org/issue7359>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 19, 2009, 5:34 PM

Post #2 of 2 (116 views)
Permalink
[issue7359] mailbox cannot modify mailboxes in system mail spool [In reply to]

Antoine Pitrou <pitrou [at] free> added the comment:

The same remark as in issue7360, that is it is not robust at all to
overwrite the file rather than doing an atomic rename from a temporary
file. The only possible exception would be if you only /append/ to the
mbox file (and that's assuming all mailbox-reading software you use be
able to deal with a partially written message at the end of an mbox file).

----------
nosy: +akuchling, pitrou
priority: -> normal
versions: +Python 2.7, Python 3.2

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue7359>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com

Python bugs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.