After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 785447 - After updating gdk-pixbuf2, *.ico format support seems broken
After updating gdk-pixbuf2, *.ico format support seems broken
Status: RESOLVED FIXED
Product: gdk-pixbuf
Classification: Platform
Component: loaders
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gdk-pixbuf-maint
gdk-pixbuf-maint
Depends on:
Blocks:
 
 
Reported: 2017-07-26 13:35 UTC by skontar
Modified: 2017-07-28 08:39 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Reproducer code (658 bytes, text/x-python)
2017-07-26 13:35 UTC, skontar
  Details
Reproducer icon (230.04 KB, image/vnd.microsoft.icon)
2017-07-26 13:36 UTC, skontar
  Details
Actual result (11.15 KB, image/png)
2017-07-26 13:36 UTC, skontar
  Details
Expected result (10.94 KB, image/png)
2017-07-26 13:36 UTC, skontar
  Details
ico: Fix icon quality sorting (942 bytes, patch)
2017-07-26 14:13 UTC, Bastien Nocera
committed Details | Review
tests: Add test case for ICO quality sorting bug (155.68 KB, patch)
2017-07-26 14:13 UTC, Bastien Nocera
committed Details | Review

Description skontar 2017-07-26 13:35:41 UTC
Created attachment 356424 [details]
Reproducer code

I have updated gdk-pixbuf2-2.36.6-1.fc25.x86_64 to gdk-pixbuf2-2.36.7-1.fc25.x86_64 (on Fedora). Tray icons and notifications using icons in *.ico format stopped working correctly. They are in incorrect scale and color palette.

See attached screenshots and reproducer code.
Comment 1 skontar 2017-07-26 13:36:09 UTC
Created attachment 356425 [details]
Reproducer icon
Comment 2 skontar 2017-07-26 13:36:28 UTC
Created attachment 356426 [details]
Actual result
Comment 3 skontar 2017-07-26 13:36:46 UTC
Created attachment 356427 [details]
Expected result
Comment 4 skontar 2017-07-26 13:37:44 UTC
Downstream bug: 
https://bugzilla.redhat.com/show_bug.cgi?id=1475286
Comment 5 Bastien Nocera 2017-07-26 13:46:11 UTC
Looks like a regression in one of those patches:
https://bugzilla.gnome.org/show_bug.cgi?id=776040

First thing would be to figure out which one of the patches breaks it, then integrate the icon into the test suite, and fix that broken commit.

My guess is this fixes it:
diff --git a/gdk-pixbuf/io-ico.c b/gdk-pixbuf/io-ico.c
index 12f0a5880..5b3646cb3 100644
--- a/gdk-pixbuf/io-ico.c
+++ b/gdk-pixbuf/io-ico.c
@@ -203,9 +203,9 @@ compare_direntry_scores (gconstpointer a,
        const struct ico_direntry_data *ib = b;
 
        /* Backwards, so largest first */
-       if (ib->ImageScore > ia->ImageScore)
+       if (ib->ImageScore < ia->ImageScore)
                return -1;
-       else if (ib->ImageScore < ia->ImageScore)
+       else if (ib->ImageScore > ia->ImageScore)
                return 1;
        return 0;
 }

(fixing commit 99508c712d50e691328f47ce137cdbfa48b2d2e7)
Comment 6 Bastien Nocera 2017-07-26 14:13:16 UTC
Created attachment 356428 [details] [review]
ico: Fix icon quality sorting

Despite the inherited comment, commit 99508c7 sorted the icons by
increasing instead of decreasing quality.
Comment 7 Bastien Nocera 2017-07-26 14:13:23 UTC
Created attachment 356429 [details] [review]
tests: Add test case for ICO quality sorting bug
Comment 8 Bastien Nocera 2017-07-26 14:16:18 UTC
Attachment 356428 [details] pushed as d6a0233 - ico: Fix icon quality sorting
Attachment 356429 [details] pushed as 9ac5cc0 - tests: Add test case for ICO quality sorting bug
Comment 9 skontar 2017-07-28 08:39:33 UTC
Thanks for quick fix. It seems to work fine.