[Python-Dev] mailbox._create_temporary without checking the file permission
Dasn
dasn at lavabit.com
Fri Aug 17 11:33:19 CEST 2007
On 17/08/07 14:41 +0800, Dasn wrote:
>Hi, guys.
>
>_create_temporary is not tracking the perm bits of the original mbox.
>
>$ ls -l me
>-rw------- 1 dasn users 274886 Aug 16 08:43 me
>$ python
>Python 2.5.1 (r251:54863, May 8 2007, 07:32:21)
>[GCC 3.3.5 (propolice)] on openbsd4
>Type "help", "copyright", "credits" or "license" for more information.
>>>> from mailbox import mbox
>>>> m=mbox('me')
>>>> m.pop(0)
><mailbox.mboxMessage instance at 0x84865ecc>
>>>> m.flush()
>>>>^D
>$ ls -l me
>-rwxr-xr-x 1 dasn users 268438 Aug 16 09:26 me*
>$
>
I think there are 2 problems should be considered in the _create_temporary:
1. what to do if we have no write permission to the directory (e.g.
/var/mail/), what about using tempfile module?
2. keep the temp file as the same mode as the original one.
--
Dasn
More information about the Python-Dev
mailing list