[issue42367] Restore os.makedirs ability to apply mode to all directories created

2021-11-22 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

A new `intermediate_mode=` kwarg can't _default_ to `mode=` as that would flip 
flop the API's default behavior again and no doubt disrupt someone elses 
3.7-3.10 authored code depending on it. :(

Regardless I do somewhat like `intermediate_mode=` more than the PR's existing 
`recursive_mode=` as it opens up more possible behaviors... Allowing `None` to 
mean "use `mode=`" is desirable as that'll likely be the most common case.  As 
I expect this to be very common, an easier to type name than intermediate_mode 
is desirable.  Brainstorming:

 * mid_mode?
 * submode?
 * imode?

My preference leans towards the latter names. Probably `submode=`.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42367] Restore os.makedirs ability to apply mode to all directories created

2021-11-19 Thread Ad Timmering


Change by Ad Timmering :


--
nosy: +awtimmering

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42367] Restore os.makedirs ability to apply mode to all directories created

2021-10-26 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
versions: +Python 3.11 -Python 3.10

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42367] Restore os.makedirs ability to apply mode to all directories created

2021-10-26 Thread Kartik Subbarao


Change by Kartik Subbarao :


--
nosy: +kartiksubbarao

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42367] Restore os.makedirs ability to apply mode to all directories created

2021-05-04 Thread JustAnotherArchivist


Change by JustAnotherArchivist :


--
nosy: +JustAnotherArchivist

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42367] Restore os.makedirs ability to apply mode to all directories created

2020-12-22 Thread Zackery Spytz


Change by Zackery Spytz :


--
keywords: +patch
nosy: +ZackerySpytz
nosy_count: 3.0 -> 4.0
pull_requests: +22756
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/23901

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42367] Restore os.makedirs ability to apply mode to all directories created

2020-11-16 Thread Christian Heimes


Christian Heimes  added the comment:

+1 for restoring the feature

+0 for Serhiy's proposal iff intermediate_mode defaults to the value of mode:


def makedirs(name, mode=0o777, exist_ok=False, *, intermediate_mode=None):
if intermediate_mode is None:
intermediate_mode = mode

--
nosy: +christian.heimes

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42367] Restore os.makedirs ability to apply mode to all directories created

2020-11-16 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Alternatively we can add an optional argument for the mode of intermediate 
directories.

makedirs(name, mode=0o777, exist_ok=False, intermediate_mode=0o777)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42367] Restore os.makedirs ability to apply mode to all directories created

2020-11-16 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

For consistency, pathlib.Path.mkdir should also gain this option.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42367] Restore os.makedirs ability to apply mode to all directories created

2020-11-16 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
type: behavior -> enhancement

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42367] Restore os.makedirs ability to apply mode to all directories created

2020-11-16 Thread Gregory P. Smith


New submission from Gregory P. Smith :

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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com