Taragolis commented on PR #28367:
URL: https://github.com/apache/airflow/pull/28367#issuecomment-1353758880
This implementation completely ignored umask for subdirectories, see:
```python
import os
from tempfile import TemporaryDirectory
from pathlib import Path
from airflow.utils.file import mkdirs
def cur_umask() -> int:
tmp = os.umask(0o022)
os.umask(tmp)
return oct(tmp)
def sample():
print(f" Current umask: {cur_umask()} ".center(72, "="))
with TemporaryDirectory() as tmpdir:
sub_path = Path(tmpdir) / "child1"
path = sub_path / "child2"
mkdirs(path, 0o770)
print(f"{sub_path} mode {oct(os.stat(sub_path).st_mode)}")
print(f"{path} mode {oct(os.stat(path).st_mode)}")
sample()
# child1 mode 0o40777
# child2 mode 0o40770
os.umask(0)
sample()
# child1 mode 0o40777
# child2 mode 0o40770
os.umask(0o002)
sample()
# child1 mode 0o40777
# child2 mode 0o40770
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]