[Django] #26591: Incorrect Manifest Keys for ManifestStaticFilesStorage on Windows

23 views
Skip to first unread message

Django

unread,
May 6, 2016, 9:18:08 AM5/6/16
to django-...@googlegroups.com
#26591: Incorrect Manifest Keys for ManifestStaticFilesStorage on Windows
-------------------------+-------------------------------------------------
Reporter: | Owner: nobody
dsanders11 |
Type: Bug | Status: new
Component: | Version: master
contrib.staticfiles | Keywords: staticfiles manifest
Severity: Normal | manifeststaticfileststorage windows
Triage Stage: | Has patch: 0
Unreviewed |
Easy pickings: 0 | UI/UX: 0
-------------------------+-------------------------------------------------
The manifest created by `ManifestStaticFilesStorage` on Windows has some
incorrect keys (haven't determined the pattern yet) where slashes are '\\'
instead of '/'.

This silently 'succeeds' because `HashedFilesMixin` will hash the original
file on a 'cache miss' (in the case of `ManifestStaticFilesStorage` it's a
manifest miss) and insert the result into the in-memory hashed files map.

I've attached a patch for staticfiles_tests which checks that the manifest
is the same in memory and on disk after the manifest tests finish (unless
it was a test which cleared the in-memory version). It passes for the
Linux build but fails on the Windows build, nicely illustrating the
problem.

--
Ticket URL: <https://code.djangoproject.com/ticket/26591>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
May 6, 2016, 9:18:50 AM5/6/16
to django-...@googlegroups.com
#26591: Incorrect Manifest Keys for ManifestStaticFilesStorage on Windows
-------------------------------------------------+-------------------------
Reporter: dsanders11 | Owner: nobody
Type: Bug | Status: new
Component: contrib.staticfiles | Version: master
Severity: Normal | Resolution:
Keywords: staticfiles manifest | Triage Stage:
manifeststaticfileststorage windows | Unreviewed
Has patch: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------------------+-------------------------
Changes (by dsanders11):

* Attachment "manifeststaticfilesstorage_test.patch" added.

Test coverage patch

Django

unread,
May 6, 2016, 11:34:32 AM5/6/16
to django-...@googlegroups.com
#26591: Incorrect Manifest Keys for ManifestStaticFilesStorage on Windows
-------------------------------------+-------------------------------------
Reporter: dsanders11 | Owner: nobody
Type: Bug | Status: new

Component: contrib.staticfiles | Version: master
Severity: Normal | Resolution:
Keywords: staticfiles | Triage Stage: Accepted
manifest |
manifeststaticfileststorage |
windows |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* needs_better_patch: => 0
* needs_docs: => 0
* needs_tests: => 0
* stage: Unreviewed => Accepted


Old description:

> The manifest created by `ManifestStaticFilesStorage` on Windows has some
> incorrect keys (haven't determined the pattern yet) where slashes are
> '\\' instead of '/'.
>
> This silently 'succeeds' because `HashedFilesMixin` will hash the
> original file on a 'cache miss' (in the case of
> `ManifestStaticFilesStorage` it's a manifest miss) and insert the result
> into the in-memory hashed files map.
>
> I've attached a patch for staticfiles_tests which checks that the
> manifest is the same in memory and on disk after the manifest tests
> finish (unless it was a test which cleared the in-memory version). It
> passes for the Linux build but fails on the Windows build, nicely
> illustrating the problem.

New description:

The manifest created by `ManifestStaticFilesStorage` on Windows has some
incorrect keys (haven't determined the pattern yet) where slashes are
`'\\'` instead of '/'.

This silently 'succeeds' because `HashedFilesMixin` will hash the original
file on a 'cache miss' (in the case of `ManifestStaticFilesStorage` it's a
manifest miss) and insert the result into the in-memory hashed files map.

I've attached a patch for staticfiles_tests which checks that the manifest
is the same in memory and on disk after the manifest tests finish (unless
it was a test which cleared the in-memory version). It passes for the
Linux build but fails on the Windows build, nicely illustrating the
problem.

--

Comment:

The final version of the patch shouldn't put the assertions in
`tearDown()`, if possible.

--
Ticket URL: <https://code.djangoproject.com/ticket/26591#comment:1>

Django

unread,
May 6, 2016, 1:17:56 PM5/6/16
to django-...@googlegroups.com
#26591: Incorrect Manifest Keys for ManifestStaticFilesStorage on Windows
-------------------------------------+-------------------------------------
Reporter: dsanders11 | Owner: nobody
Type: Bug | Status: new

Component: contrib.staticfiles | Version: master
Severity: Normal | Resolution:
Keywords: staticfiles | Triage Stage: Accepted
manifest |
manifeststaticfileststorage |
windows |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by dsanders11):

Yea, it's not a 'correct' place to put assertions, but it was the best
spot to put the assertion to run the code after all test cases, short of a
much more intrusive patch. The nice bit about putting it there is that it
automatically is run for all new test cases added.

The alternative would be to add it to the end of each of the test cases (I
think it's a couple dozen), or to think of a clever way to get a 'post-
test pre-tearDown' hook in place.

--
Ticket URL: <https://code.djangoproject.com/ticket/26591#comment:2>

Django

unread,
Jun 2, 2021, 2:53:33 PM6/2/21
to django-...@googlegroups.com
#26591: Incorrect Manifest Keys for ManifestStaticFilesStorage on Windows
-------------------------------------+-------------------------------------
Reporter: David Sanders | Owner: nobody
Type: Bug | Status: closed
Component: contrib.staticfiles | Version: dev
Severity: Normal | Resolution: fixed

Keywords: staticfiles | Triage Stage: Accepted
manifest |
manifeststaticfileststorage |
windows |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jacob Walls):

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


Comment:

Fixed in 53bffe8d03f01bd3214a5404998cb965fb28cd0b. The attached test case
became `assertPostCondition()`. The author explained in PR comments
finding, reporting, and fixing the issue in the same PR.

--
Ticket URL: <https://code.djangoproject.com/ticket/26591#comment:3>

Reply all
Reply to author
Forward
0 new messages