New submission from Gregory P. Smith <g...@krypto.org>:

os.makedirs used to pass its mode argument on down recursively so that every 
level of directory it created would have the specified permissions.

That was removed in Python 3.7 as https://bugs.python.org/issue19930 as if it 
were a mis-feature.  Maybe it was in one situation, but it was also a desirable 
*feature*.  It wasn't a bug.

We've got 15 year old code depending on that and the only solution for it to 
work on Python 3.7-3.9 is to reimplement recursive directory creation. :(

This feature needs to be brought back.  Rather than flip flop on the API, 
adding an flag to indicate if the permissions should be applied recursively or 
not seems like the best way forward.

The "workaround" documented in the above bug is invalid.  umask cannot be used 
to control the intermediate directory creation permissions as that is a process 
wide global that would impact other threads or signal handlers.  umask also 
cannot be used as umask does not allow setting of special bits such as 
stat.S_ISVTX.

result: Our old os.makedirs() code that tried to set the sticky bit (ISVTX) on 
all directories now fails to set it at all levels.

----------
components: Library (Lib)
keywords: 3.7regression
messages: 381082
nosy: gregory.p.smith, serhiy.storchaka
priority: normal
severity: normal
stage: needs patch
status: open
title: Restore os.makedirs ability to apply mode to all directories created
type: behavior
versions: Python 3.10

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

Reply via email to