﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
17737	collectstatic copies wrong files to STATIC_ROOT	Maciej Wiśniowski	Jannis Leidel	"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."	Bug	closed	contrib.staticfiles	1.3	Normal	fixed		pigletto@… slinkp@…	Accepted	1	0	0	0	0	0
