[New-bugs-announce] [issue3228] mailbox.mbox creates files with execute bit set

Piotr Lewandowski report at bugs.python.org
Sat Jun 28 21:23:39 CEST 2008


New submission from Piotr Lewandowski <piotr.lewandowski at gmail.com>:

#v+
$ umask
0077

$ stat /tmp/foobar
stat: cannot stat `/tmp/foobar': No such file or directory

$ python -c "from mailbox import mbox; m=mbox('/tmp/foobar',
create=True); m.add(''); m.close()"

$ stat -c '%A' /tmp/foobar
-rwx------
#v-

Bug is probably present in _create_carefully() function in mailbox.py.
os.open() takes mode argument (which defaults to 0777) but it's not
supplied there.

#v+
$ grep -A2 'def _create_carefully' /usr/lib/python2.5/mailbox.py
def _create_carefully(path):
    """Create a file if it doesn't exist and open for reading and
writing."""
    fd = os.open(path, os.O_CREAT | os.O_EXCL | os.O_RDWR)
#v-

----------
components: Library (Lib)
messages: 68896
nosy: pl
severity: normal
status: open
title: mailbox.mbox creates files with execute bit set
type: behavior
versions: Python 2.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3228>
_______________________________________


More information about the New-bugs-announce mailing list