Opened 11 years ago

Closed 11 years ago

Last modified 7 years ago

#6450 closed (fixed)

Incorrect directory creation in _save_FIELD_file

Reported by: henry Owned by: nobody
Component: Database layer (models, ORM) Version: master
Severity: Keywords: file directory creation fs-rf-fixed
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: no UI/UX: no


The function _save_FIELD_file incorrectly assumes that if makedirs throw an Exception it is because the directory already exists.

All kind of errors can trigger an exception (permission denied / no space left on device / hardware error ...). By silently ignoring the error, this function makes it harder to detect these problems.

The attached patch fixes these problems.

Attachments (2)

directory_creation.diff (1.0 KB) - added by henry <henry@…> 11 years ago.
directory_creation_tests.diff (2.5 KB) - added by vung 11 years ago.

Download all attachments as: .zip

Change History (9)

Changed 11 years ago by henry <henry@…>

Attachment: directory_creation.diff added

comment:1 Changed 11 years ago by Chris Beaven

Triage Stage: UnreviewedDesign decision needed

Agreed, current code does seem to be a big presumption.

I'll pass through a design decision, since this is a potentially fundamental change. I can't see anything wrong with it though.

comment:2 Changed 11 years ago by Marty Alchin

Keywords: fs-rf added

comment:3 Changed 11 years ago by Marty Alchin

Keywords: fs-rf-fixed added; fs-rf removed

comment:4 Changed 11 years ago by Marty Alchin

milestone: 1.0 beta

comment:5 Changed 11 years ago by Russell Keith-Magee

Needs tests: set
Triage Stage: Design decision neededAccepted

Yes, this is a change, but I can't see how anyone could be relying on the existing behaviour. Marking as accepted; patch needs tests.

Changed 11 years ago by vung

comment:6 Changed 11 years ago by Russell Keith-Magee

Resolution: fixed
Status: newclosed

(In [8007]) Fixed #6450 -- Improved the checking of errors when creating the directories for saved files. Thanks to henry@… for the report and patch, and vung for the excellent test case.

comment:7 Changed 7 years ago by Jacob

milestone: 1.0 beta

Milestone 1.0 beta deleted

Note: See TracTickets for help on using tickets.
Back to Top