﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
31921	Python 3.7: new behavior of os.makedirs breaks FileSystemStorage permissions on intermediate directories	WhiteSage	Mariusz Felisiak	"From the python os library documentation (https://docs.python.org/3/library/os.html), regarding os.makedirs:
{{{
Changed in version 3.7: The mode argument no longer affects the file permission bits of newly-created intermediate-level directories.
}}}
As FileSystemStorage._save() directly calls os.makedirs all intermediate folders will be created with 777 permissions, ignoring the directory_permissions_mode member field.

Steps to reproduce:

{{{ 
django-admin startproject bugreport 
}}}

Append to settings.py

{{{
STATIC_ROOT = BASE_DIR / 'static'

FILE_UPLOAD_DIRECTORY_PERMISSIONS = 0o750
}}}

Call
{{{
python manage.py collectstatic
}}}

Intermediate folders such as static/admin will have permissions 777.

Note: python version at least 3.7 is required!

Could have security implications when running on a production server."	Bug	closed	File uploads/storage	2.2	Release blocker	fixed	python3.7 makedirs permissions		Accepted	0	0	0	0	0	0
