Django

Code

Ticket #6450 (closed: fixed)

Opened 11 months ago

Last modified 5 months ago

Incorrect directory creation in _save_FIELD_file

Reported by: henry Assigned to: nobody
Milestone: 1.0 beta Component: Database layer (models, ORM)
Version: SVN Keywords: file directory creation fs-rf-fixed
Cc: Triage Stage: Accepted
Has patch: 1 Needs documentation: 0
Needs tests: 1 Patch needs improvement: 0

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

directory_creation.diff (1.0 kB) - added by henry <henry@precheur.org> on 01/23/08 11:42:44.
directory_creation_tests.diff (2.5 kB) - added by vung on 06/28/08 09:44:20.

Change History

01/23/08 11:42:44 changed by henry <henry@precheur.org>

  • attachment directory_creation.diff added.

01/23/08 12:48:31 changed by SmileyChris

  • needs_better_patch changed.
  • stage changed from Unreviewed to Design decision needed.
  • needs_tests changed.
  • needs_docs changed.

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.

02/09/08 22:33:38 changed by Gulopine

  • keywords changed from file directory creation to file directory creation fs-rf.

06/16/08 12:35:28 changed by Gulopine

  • keywords changed from file directory creation fs-rf to file directory creation fs-rf-fixed.

06/16/08 13:30:54 changed by Gulopine

  • milestone set to 1.0 beta.

06/25/08 04:59:56 changed by russellm

  • needs_tests set to 1.
  • 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.

06/28/08 09:44:20 changed by vung

  • attachment directory_creation_tests.diff added.

07/20/08 07:44:42 changed by russellm

  • status changed from new to closed.
  • resolution set to fixed.

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


Add/Change #6450 (Incorrect directory creation in _save_FIELD_file)




Change Properties
Action