[issue7359] mailbox cannot modify mailboxes in system mail spool

2016-02-07 Thread Mahmoud Hashemi

Mahmoud Hashemi added the comment:

Got bit by this, and since it's not a bug, here's "not" a fix: 
http://boltons.readthedocs.org/en/latest/mboxutils.html#boltons.mboxutils.mbox_readonlydir

Been in production for a while, working like a charm. Might there be interest 
in including this in the standard lib?

--
nosy: +mahmoud

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7359] mailbox cannot modify mailboxes in system mail spool

2012-06-18 Thread Petri Lehtinen

Petri Lehtinen pe...@digip.org added the comment:

Every program that accesses mailboxes in the system-wide mail spool directory 
needs to have write access to it. This is because dot-locking is achieved by 
creating additional files to that directory, and it must be used (in addition 
to fcntl() locking) to avoid messing up the mailboxes because of concurrent 
access.

In Debian, /var/mail is owned by root:mail with mode 2755, and every MUA is 
setgid mail. See the Debian Policy Manual section 11.6 for more information:


http://www.debian.org/doc/debian-policy/ch-customized-programs.html#s-mail-transport-agents

If you write a MUA or MTA using Python's mailbox module, your program needs to 
have write access to /var/mail. That's the only way to do it correctly. It also 
makes the mailbox module's renaming behavior possible.

--
nosy: +petri.lehtinen
resolution:  - invalid
stage:  - committed/rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7359
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7359] mailbox cannot modify mailboxes in system mail spool

2011-05-05 Thread Steffen Daode Nurpmeso

Steffen Daode Nurpmeso sdao...@googlemail.com added the comment:

Issue #11935 becomes gigantic and may even swamp this one over!

--
nosy: +sdaoden

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7359
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7359] mailbox cannot modify mailboxes in system mail spool

2010-12-01 Thread Ole Laursen

Ole Laursen o...@iola.dk added the comment:

Just got bitten by this too.

Renaming is good and all, but as far as I can tell, it will never work with the 
system spool. It's not just that you can't create a temporary file in the 
directory, you can't rename files into it either. If I create an empty file 
somewhere and try to rename it to overwrite my mailbox, I get a permission 
denied. Sad. :(

So I think you have to bite the bullet and write directly to the file. Either 
that or define that the module can't be used to work with system spool 
mailboxes, at least on Debian. But that would be even more sad.

--
nosy: +olau

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7359
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7359] mailbox cannot modify mailboxes in system mail spool

2009-11-19 Thread Matthias Klose

New submission from Matthias Klose d...@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 rep...@bugs.python.org
http://bugs.python.org/issue7359
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7359] mailbox cannot modify mailboxes in system mail spool

2009-11-19 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr 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 rep...@bugs.python.org
http://bugs.python.org/issue7359
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com