[New-bugs-announce] [issue11306] mailbox should test for errno.EROFS

Matt Johnston report at bugs.python.org
Thu Feb 24 08:03:32 CET 2011

New submission from Matt Johnston <matt at ucc.asn.au>:

When opening mailboxes the module checks for errno.EACCES. This doesn't help if the location is mounted read-only. Something like the following (against Python 2.6) would fix it, there are a few other checks in mailbox.py for EACCES too.

--- mailbox.py.orig	2011-02-24 15:02:22.000000000 +0800
+++ mailbox.py	2011-02-24 15:02:05.000000000 +0800
@@ -512,7 +512,7 @@ class _singlefileMailbox(Mailbox):
                     f = open(self._path, 'wb+')
                     raise NoSuchMailboxError(self._path)
-            elif e.errno == errno.EACCES:
+            elif e.errno == errno.EACCES or e.errno == errno.EROFS:
                 f = open(self._path, 'rb')

components: Library (Lib)
messages: 129252
nosy: matt
priority: normal
severity: normal
status: open
title: mailbox should test for errno.EROFS
type: behavior
versions: Python 3.3

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list