[issue5220] os.makedirs' mode argument has bad default value
Sindre Myren smyr...@gmail.com added the comment: Thank you very much for the clarification :) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5220 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5220] os.makedirs' mode argument has bad default value
Sindre Myren smyr...@gmail.com added the comment: I don't understand what you mean when you say how umask works in relation to Python. How it works in relation to Python isn't different from how it works for any other Unix program. Consider, for example, the unix man page for 'open'. This is what I mean. The following gnu commands give (on Archlinux): $ umask 0022 $ mkdir test1 $ mkdir test2 --mode 0777 $ ls -l drwxr-xr-x 2 sindrero users 4096 Jun 15 00:59 test drwxrwxrwx 2 sindrero users 4096 Jun 15 00:59 test2 So we see that new folder created with the --mode parameter to gnu's mkdir does not get the umask masked out. The following code in python gives: import os os.mkdir('test3') os.mkdir('test4') exit() $ ls -l drwxr-xr-x 2 sindrero users 4096 Jun 15 01:01 test3 drwxr-xr-x 2 sindrero users 4096 Jun 15 01:01 test4 I (as a programmer) have never seen the specific code for python's mkdir function, And I have no way to know whether I should presume that mkdir in python works the same way as the gnu command or not. Unless it is documented that is. Cheers :) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5220 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5220] os.makedirs' mode argument has bad default value
Sindre Myren smyr...@gmail.com added the comment: *Sorry.. A bit quick there. The line os.mkdir('test4') should have been: os.mkdir('test4', 0777) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5220 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5220] os.makedirs' mode argument has bad default value
Sindre Myren smyr...@gmail.com added the comment: I have to agree with jab. While the way relative paths works are more or less common knowledge, the way umask does and does not work in relation to python isn't. It is however given a short description at http://docs.python.org/library/os.html#os.makedirs: ...The default mode is 0777 (octal). On some systems, mode is ignored. Where it is used, the current umask value is first masked out. And as it is documented (briefly) online that the umask *is* used, perhaps it is not necessary to add it to the doc-string? -- nosy: +smyrman ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5220 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com