[Python-Dev] mailbox._create_temporary without checking the file permission

2007-08-17 Thread Dasn
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)

>>> m.flush()
>>>^D
$ ls -l me
-rwxr-xr-x  1 dasn  users  268438 Aug 16 09:26 me*
$

-- 
Dasn

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] mailbox._create_temporary without checking the file permission

2007-08-17 Thread Dasn
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)
>
>>>> 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

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com