Opened 8 years ago

Closed 7 years ago

Last modified 4 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: UI/UX:

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

Download all attachments as: .zip

Change History (9)

Changed 8 years ago by henry <henry@…>

comment:1 Changed 8 years ago by SmileyChris

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Design 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 8 years ago by Gulopine

  • Keywords fs-rf added

comment:3 Changed 7 years ago by Gulopine

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

comment:4 Changed 7 years ago by Gulopine

  • milestone set to 1.0 beta

comment:5 Changed 7 years ago by russellm

  • Needs tests set
  • Triage Stage changed from Design decision needed to Accepted

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 7 years ago by vung

comment:6 Changed 7 years ago by russellm

  • Resolution set to fixed
  • Status changed from new to closed

(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 4 years ago by jacob

  • milestone 1.0 beta deleted

Milestone 1.0 beta deleted

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