#36298: file_move_safe with allow_overwrite=True does not truncate previous file
when there is an OSError error on rename
-------------------------------------+-------------------------------------
     Reporter:  Sarah Boyce          |                    Owner:  Sarah
                                     |  Boyce
         Type:  Bug                  |                   Status:  assigned
    Component:  File                 |                  Version:  5.2
  uploads/storage                    |
     Severity:  Release blocker      |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Baptiste Mispelon):

 * cc: Baptiste Mispelon (added)
 * stage:  Unreviewed => Accepted

Comment:

 I agree with the "Release blocker" categorisation on the basis that this
 is a data corrupting bug (which falls under "data loss" imo).

 I've reviewed the proposed PR and the code change looks reasonable (and
 simple enough that backporting it should hopefully not cause any issues).

 The test added in the PR fails without the associated code change
 (`os.O_TRUNC`) and passes with it.

 I've also tested the change on the djangoproject.com codebase where it was
 initially spotted [1]  and it fixes the issue (it's a bit tricky to get
 this to reproduce since several conditions need to be met, one of them
 being that the uploaded file should be bigger than
 `settings.FILE_UPLOAD_MAX_MEMORY_SIZE`).

 I'm tempted to mark this as "ready for checkin", but I //think// it might
 require a release note mention (or is that only for the backport?).

 [1] https://github.com/django/djangoproject.com/issues/2015
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36298#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/010701960092057c-f0268b98-1cb8-4d71-b03e-49dbfd7aaa59-000000%40eu-central-1.amazonses.com.

Reply via email to