#26691: Don't check for a file's existence before deleting
--------------------------------------+------------------------------------
     Reporter:  jdufresne             |                    Owner:  nobody
         Type:  Cleanup/optimization  |                   Status:  closed
    Component:  File uploads/storage  |                  Version:  master
     Severity:  Normal                |               Resolution:  fixed
     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 Tim Graham <timograham@…>):

 * status:  new => closed
 * resolution:   => fixed


Comment:

 In [changeset:"359be1c8702ede41e7fe823ed13350795ba96a61" 359be1c8]:
 {{{
 #!CommitTicketReference repository=""
 revision="359be1c8702ede41e7fe823ed13350795ba96a61"
 Fixed #26691 -- Removed checking for a file's existence before deleting.

 File operations always raise a ENOENT error when a file doesn't exist.
 Checking the file exists before the operation adds a race condition
 condition where the file could be removed between operations. As the
 operation already raises an error on a missing file, avoid this race and
 avoid checking the file exists twice. Instead only check a file exists
 by catching the ENOENT error.
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/26691#comment:1>
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.be6c4211900023d0db3e75986ec43133%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to