#17737: collectstatic copies wrong files to STATIC_ROOT
-------------------------------------+--------------------
     Reporter:  pigletto             |      Owner:  nobody
         Type:  Bug                  |     Status:  new
    Component:  contrib.staticfiles  |    Version:  1.3
     Severity:  Normal               |   Keywords:
 Triage Stage:  Unreviewed           |  Has patch:  1
Easy pickings:  0                    |      UI/UX:  0
-------------------------------------+--------------------
 In specific situation, in Django 1.3.1, second run of collecstatic command
 might copy wrong files to STATIC_ROOT. This is dangerous situation in
 production environment.

 Attached test and patch against tags/1.3.1

 This issue doesn't exist in current trunk (Django 1.4) but seems to me
 that it might been fixed 'accidentally' so I also attach (passing) test
 for current trunk.

 To reproduce the issue:
 1. INSTALLED_APPS = ['appA', 'appB']
 2. static files in apps:
 {{{
 appA/
    static/
         file.js

 appB/
    static/
         file.js
 }}}

 3. Modification date of file.js in '''appB''' is newer than modification
 date of file.js in '''appA'''

 4. run collectstatic '''twice'''

 At first run everything is OK. File from appA is copied to STATIC_ROOT (as
 documentation says duplicate files are taken in order of apps in
 INSTALLED_APPS), but in second run file.js is replaced by ''wrong'' one -
 from '''appB'''.

 This is caused by use of:

 {{{
  shutil.copy2(source_path, full_path)
 }}}

 in copy_file method at collectstatic.py.

 shutil.copy2 preservers original file modification date what causes that
 file.js from '''appB''' is considered newer than file in STATIC_ROOT.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/17737>
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 post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to