Opened 17 years ago

Closed 16 years ago

Last modified 13 years ago

#6450 closed (fixed)

Incorrect directory creation in _save_FIELD_file

Reported by: henry Owned by: nobody
Component: Database layer (models, ORM) Version: dev
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

Description

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@…> 17 years ago.
directory_creation_tests.diff (2.5 KB ) - added by vung 17 years ago.

Download all attachments as: .zip

Change History (9)

by henry <henry@…>, 17 years ago

Attachment: directory_creation.diff added

comment:1 by Chris Beaven, 17 years ago

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 by Marty Alchin, 17 years ago

Keywords: fs-rf added

comment:3 by Marty Alchin, 17 years ago

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

comment:4 by Marty Alchin, 17 years ago

milestone: 1.0 beta

comment:5 by Russell Keith-Magee, 17 years ago

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.

by vung, 17 years ago

comment:6 by Russell Keith-Magee, 16 years ago

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 by Jacob, 13 years ago

milestone: 1.0 beta

Milestone 1.0 beta deleted

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