Hynek Schlawack added the comment:

So, IMHO if someone calls os.makedirs with a mode != 0o777, they expect to have 
the directories having those modes afterward. So raising no error if they exist 
and have the wrong mode would be a plain bug.

Python 3.3 already has a helpful error message:

FileExistsError: [Errno 17] File exists (mode 777 != expected mode 755): 'foo'

and it also handles the sticky issue gracefully: 
http://hg.python.org/cpython/file/3a08d766eee3/Lib/os.py#l270 

So this are an non-issues for 3.3. I'm not sure if it's severe enough to be 
back ported to 3.2.

So there’s only one thing left: the docs are wrong and should be fixed about 
exist_ok's behavior for both 3.2 & 3.3.


That said, I see the rationale for fixing the permissions but we can't just 
change os.makedirs at this point.

So I'd propose to add a "fix_permissions" bool flag that would allow the "no 
matter what the state is now, I want dir x with permissions y, do whatever is 
necessary workflow."

Opinions?

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue13498>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to