RESOLVED FIXED 171058
[GTK] After upgrading glib and glib-networking, resources with zero bytes are always identified as text/plain
https://bugs.webkit.org/show_bug.cgi?id=171058
Summary [GTK] After upgrading glib and glib-networking, resources with zero bytes are...
Carlos Alberto Lopez Perez
Reported 2017-04-20 09:21:31 PDT
On r215556 <https://trac.webkit.org/r215556> we upgraded glib from 2.44.1 to 2.52.1 and glib-networking from 2.41.4 to 2.50.0 This causes failures on the following tests: Regressions: Unexpected text-only failures (13) fast/preloader/document-write-noscript.html [ Failure ] fast/preloader/document-write.html [ Failure ] fast/preloader/first-base-tag-scanned-wins.html [ Failure ] fast/preloader/first-base-tag-wins.html [ Failure ] fast/preloader/image-srcset.html [ Failure ] fast/preloader/image.html [ Failure ] fast/preloader/input.html [ Failure ] fast/preloader/link.html [ Failure ] fast/preloader/noscript.html [ Failure ] fast/preloader/script.html [ Failure ] fast/preloader/style.html [ Failure ] fast/preloader/understands-base-tag.html [ Failure ] tables/mozilla/core/col_widths_fix_autoFixPer.html [ Failure ] This are the diffs for all this tests: http://sprunge.us/GZPB?diff As you can see, the resource gives always now "MIME type text/plain" instead of the MIME type of the extension of the file. Upon further investigation it turns out, all this files are empty! $ ls -1s LayoutTests/fast/preloader/resources/script1.js LayoutTests/fast/preloader/resources/noscript-image2.png LayoutTests/fast/preloader/resources/base-image3.png LayoutTests/fast/preloader/resources/base-image2.png LayoutTests/fast/preloader/resources/image1.png LayoutTests/fast/preloader/resources/base-image1.png LayoutTests/fast/preloader/resources/image1.png LayoutTests/fast/preloader/resources/link1.css LayoutTests/fast/preloader/resources/noscript-image2.png LayoutTests/fast/preloader/resources/script1.js LayoutTests/fast/preloader/resources/style1.css LayoutTests/fast/preloader/resources/base-image1.png 0 LayoutTests/fast/preloader/resources/base-image1.png 0 LayoutTests/fast/preloader/resources/base-image1.png 0 LayoutTests/fast/preloader/resources/base-image2.png 0 LayoutTests/fast/preloader/resources/base-image3.png 0 LayoutTests/fast/preloader/resources/image1.png 0 LayoutTests/fast/preloader/resources/image1.png 0 LayoutTests/fast/preloader/resources/link1.css 0 LayoutTests/fast/preloader/resources/noscript-image2.png 0 LayoutTests/fast/preloader/resources/noscript-image2.png 0 LayoutTests/fast/preloader/resources/script1.js 0 LayoutTests/fast/preloader/resources/script1.js 0 LayoutTests/fast/preloader/resources/style1.css $ file LayoutTests/fast/preloader/resources/script1.js LayoutTests/fast/preloader/resources/noscript-image2.png LayoutTests/fast/preloader/resources/base-image3.png LayoutTests/fast/preloader/resources/base-image2.png LayoutTests/fast/preloader/resources/image1.png LayoutTests/fast/preloader/resources/base-image1.png LayoutTests/fast/preloader/resources/image1.png LayoutTests/fast/preloader/resources/link1.css LayoutTests/fast/preloader/resources/noscript-image2.png LayoutTests/fast/preloader/resources/script1.js LayoutTests/fast/preloader/resources/style1.css LayoutTests/fast/preloader/resources/base-image1.png LayoutTests/fast/preloader/resources/script1.js: empty LayoutTests/fast/preloader/resources/noscript-image2.png: empty LayoutTests/fast/preloader/resources/base-image3.png: empty LayoutTests/fast/preloader/resources/base-image2.png: empty LayoutTests/fast/preloader/resources/image1.png: empty LayoutTests/fast/preloader/resources/base-image1.png: empty LayoutTests/fast/preloader/resources/image1.png: empty LayoutTests/fast/preloader/resources/link1.css: empty LayoutTests/fast/preloader/resources/noscript-image2.png: empty LayoutTests/fast/preloader/resources/script1.js: empty LayoutTests/fast/preloader/resources/style1.css: empty LayoutTests/fast/preloader/resources/base-image1.png: empty And for the test tables/mozilla/core/col_widths_fix_autoFixPer.html it turns out also this test is just an empty html $ ls -s1 LayoutTests/tables/mozilla/core/col_widths_fix_autoFixPer.html 0 LayoutTests/tables/mozilla/core/col_widths_fix_autoFixPer.html $ file LayoutTests/tables/mozilla/core/col_widths_fix_autoFixPer.html LayoutTests/tables/mozilla/core/col_widths_fix_autoFixPer.html: empty That explains the diff on this test also.
Attachments
Patch (7.70 KB, patch)
2017-05-12 04:21 PDT, Claudio Saavedra
no flags
Carlos Alberto Lopez Perez
Comment 1 2017-04-20 09:47:09 PDT
Carlos Alberto Lopez Perez
Comment 2 2017-04-20 09:47:38 PDT
(In reply to Carlos Alberto Lopez Perez from comment #1) > Expectations updated at https://trac.webkit.org/changeset/215556 ^^^ I mean at: http://trac.webkit.org/changeset/215561
Carlos Garcia Campos
Comment 3 2017-04-21 00:02:01 PDT
I think this was broken by this commit https://git.gnome.org/browse/glib/commit/?id=202a9c3497e0c0b5789e533509dd8671617ae20c Before this commit the empty file check was done after the g_content_type_guess and only when guessing from path returned an uncertain result. Now the check is done before unconditionally, so there's no basename guess for empty files.
Carlos Garcia Campos
Comment 4 2017-04-21 00:39:38 PDT
Reading the comments in the GNOME bug it seems the change in behavior was accidental, but then they decided it was an improvement. I kind of agree that a zero size file with .png extension is not a png file (or any other extension). I bet this only affects unit tests, so we can work around the issue inside webkit, either patching glib to only check zero-sized files after guessing the content type form the filename if the result is uncertain, or using real files (small enough, but real) in the tests.
Carlos Alberto Lopez Perez
Comment 5 2017-04-21 03:30:19 PDT
(In reply to Carlos Garcia Campos from comment #4) > Reading the comments in the GNOME bug it seems the change in behavior was > accidental, but then they decided it was an improvement. I kind of agree > that a zero size file with .png extension is not a png file (or any other > extension). I bet this only affects unit tests, so we can work around the > issue inside webkit, either patching glib to only check zero-sized files > after guessing the content type form the filename if the result is > uncertain, or using real files (small enough, but real) in the tests. I wonder why this files are empty on our Layout tests. Is that intentional? Or it is a mistake nobody noticed so far? Looking at the git history of this file nothing seems to suggest that the files are empty on purpose. It looks like a mistake. Maybe we should replace the empty files with files valid for their supposed mime-type (for example, for a png file we can use a 1x1 transparent png). At the same time we can add a new test that loads several zero-byte resource files. This test should produce plain/text on glib based ports and other thing on the rest of ports.
Carlos Garcia Campos
Comment 6 2017-04-21 04:19:40 PDT
I guess they are empty because the actual contents doesn't really matter. So, making them valid for their mime type would be harmless, and would fix these tests for the glib based ports.
Michael Catanzaro
Comment 7 2017-04-21 06:49:53 PDT
I would vote for changing the tests to not use empty files. This is a silly reason to carry a downstream patch forever and it's not advantageous for our tests to exhibit special behavior that never occurs in releases.
Claudio Saavedra
Comment 8 2017-05-12 04:21:20 PDT
Carlos Garcia Campos
Comment 9 2017-05-12 05:30:01 PDT
Comment on attachment 309888 [details] Patch Thanks!
WebKit Commit Bot
Comment 10 2017-05-12 05:58:47 PDT
Comment on attachment 309888 [details] Patch Clearing flags on attachment: 309888 Committed r216762: <http://trac.webkit.org/changeset/216762>
WebKit Commit Bot
Comment 11 2017-05-12 05:58:49 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.