﻿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
29890	FileSystemStorage._save() doesn't catch FileExistsError on concurrent os.mkdirs()	mar77i	Vishvajit Pathak	"My django tests (ran in `--parallel`) raised an exception which Django appears to attempt to be dealing with already:

{{{
Traceback (most recent call last):
  [...]
  File ""[app dir]/models.py"", line 56, in create_user
    return self._create_user(email, password, **extra_fields)
  File ""[app dir]/models.py"", line 50, in _create_user
    user.save(using=self._db)
  File ""[app dir]/models.py"", line 157, in save
    save=False
  File ""[project dir]venv/lib/python3.5/site-packages/django/db/models/fields/files.py"", line 87, in save
    self.name = self.storage.save(name, content, max_length=self.field.max_length)
  File ""[project dir]venv/lib/python3.5/site-packages/django/core/files/storage.py"", line 49, in save
    return self._save(name, content)
  File ""[project dir]venv/lib/python3.5/site-packages/django/core/files/storage.py"", line 236, in _save
    os.makedirs(directory)
  File ""/usr/lib/python3.5/os.py"", line 241, in makedirs
    mkdir(name, mode)
FileExistsError: [Errno 17] File exists: '[storage dir]'
}}}

Inspecting storage.py showes that os.makedirs() is guarded with a try...except block concerning FileNotFoundError, but apparently, FileExistsError appears to be what that exception handler was supposed to be catching."	Bug	closed	File uploads/storage	2.1	Normal	fixed		Vishvajit Pathak	Accepted	1	0	0	0	0	0
