[issue19930] os.makedirs('dir1/dir2', 0) always fails

Serhiy Storchaka report at bugs.python.org
Sun Dec 8 12:09:05 CET 2013


New submission from Serhiy Storchaka:

os.makedirs() can't create a directory with cleared write or list permission bits for owner when parent directories aren't created. This is because for parent directories same mode is used as for final directory.

Note that the mkdir utility creates parent directories with default mode (0o777 & ~umask).

$ mkdir -p -m 0 t1/t2/t3
$ ls -l -d t1 t1/t2 t1/t2/t3
drwxrwxr-x 3 serhiy serhiy 4096 Dec  7 22:30 t1/
drwxrwxr-x 3 serhiy serhiy 4096 Dec  7 22:30 t1/t2/
d--------- 2 serhiy serhiy 4096 Dec  7 22:30 t1/t2/t3/

The proposed patch emulates the mkdir utility.

See also issue19921.

----------
components: Library (Lib)
messages: 205543
nosy: serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: os.makedirs('dir1/dir2', 0) always fails
type: behavior
versions: Python 2.7, Python 3.3, Python 3.4

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


More information about the Python-bugs-list mailing list