Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 465658 - x11-libs/cairo-1.12.14 treats libpng-1.6 warning as error
Summary: x11-libs/cairo-1.12.14 treats libpng-1.6 warning as error
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Library (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Ben de Groot (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: libpng16
  Show dependency tree
 
Reported: 2013-04-12 09:34 UTC by Richard Grenville
Modified: 2013-04-27 10:24 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Grenville 2013-04-12 09:34:45 UTC
Strictly speaking this issue has nothing to do with Gentoo. It's entirely an upstream problem of fcitx and cairo, but, just to keep a record here, so that people won't report again and again.

After upgrade to media-libs/libpng-1.6.1 fcitx crashes when enabling an input method with classic UI:

---
    =========================
    FCITX 4.2.7 -- Get Signal No.: 11
    Date: try "date -d @1365675123" if you are using GNU date ***
    ProcessID: 2129
    fcitx[0x401828]
    /lib64/libc.so.6(+0x38630)[0x7f4e266f3630]
    /usr/lib64/fcitx/fcitx-classic-ui.so(+0x108d1)[0x7f4e1a9bb8d1]
    /usr/lib64/fcitx/fcitx-classic-ui.so(+0x83cf)[0x7f4e1a9b33cf]
    /usr/lib64/fcitx/fcitx-classic-ui.so(+0x56e9)[0x7f4e1a9b06e9]
    /usr/lib64/libfcitx-core.so.0(+0x10326)[0x7f4e270bb326]
    /usr/lib64/libfcitx-core.so.0(+0x139ea)[0x7f4e270be9ea]
    /usr/lib64/libfcitx-core.so.0(FcitxInstanceProcessKey+0xaf0)[0x7f4e270c0490]
    /usr/lib64/fcitx/fcitx-ipc.so(+0x4317)[0x7f4e18e4b317]
    /usr/lib64/libdbus-1.so.3(+0x1a785)[0x7f4e25d63785]
    /usr/lib64/libdbus-1.so.3(dbus_connection_dispatch+0x2d1)[0x7f4e25d58a91]
    /usr/lib64/fcitx/fcitx-dbus.so(+0x2128)[0x7f4e25f88128]
    /usr/lib64/libfcitx-core.so.0(+0xaa0e)[0x7f4e270b5a0e]
    /lib64/libpthread.so.0(+0x8f3b)[0x7f4e26a6ef3b]
    /lib64/libc.so.6(clone+0x6d)[0x7f4e267a965d]
----

(There's actually another issue, #465044, that could cause a crash in fcitx as well, but it has just been fixed.)

Just quoting what I said in the cairo bug report, because I'm lazy. :-)

--
... But later I found fcitx is still segfaulting sometimes, because it fails to load some particular PNG files with cairo_image_surface_create_from_png() and it isn't handling the failure gracefully. The PNG file used to work correctly with cairo and libpng-1.5, but with libpng-1.6.1 cairo could no longer load it. Further debugging reveals cairo refuses to load the file because libpng-1.6.1 emits a warning:

----
Breakpoint 5, png_simple_warning_callback (png=0x555555759c00, 
    error_msg=0x7fffffffd870 "iCCP: known incorrect sRGB profile") at cairo-png.c:151
----

"iCCP: known incorrect sRGB profile" isn't actually a fatal issue in a PNG file, and <libpng-1.6 probably doesn't emit this warning. Yet since cairo treats libpng warnings as errors, it refuses to the load the file.
--

Currently the sole application I know that fails because of this cairo issue is fcitx, but probably there are other applications around that have the same problem, considering usage of old ICC color profiles (two HP-Microsoft sRGB v2 color profiles released in 1998), which libpng-1.6 emits a warning about, could be pretty common.

Bug report on fcitx's side (in Chinese): http://code.google.com/p/fcitx/issues/detail?id=678
Bug report on FreeDesktop (cairo): https://bugs.freedesktop.org/show_bug.cgi?id=63359

I've attached my own ugly patch that let cairo ignores libpng warnings in the cairo bug report: https://bugs.freedesktop.org/attachment.cgi?id=77853


Reproducible: Always

Steps to Reproduce:
1. Upgrade to >=libpng-1.6
2. Start fcitx and enable an input method
3.
Actual Results:  
fcitx segfaults.

Expected Results:  
fcitx works.
Comment 1 Richard Grenville 2013-04-13 01:24:40 UTC
fcitx developers have fixed the outdated ICC color profile issues within the PNG images bundled with fcitx in the git repo ( https://github.com/fcitx/fcitx/commit/dc36c1a88f863971f81a76b8d9ec0db23b0d9387 ).

However, he also indicated there are a lot of images around with outdated ICC color profile, and suggested me to search in /usr/share/icons `(find /usr/share/icons -iname '*.png' -type f -exec identify -verbose '{}' +) |& grep 'known incorrect sRGB profile'` . I indeed found quite some PNG images with "known incorrect sRGB profile" in my /usr/share/icons, and (unpatched) cairo cannot load those images, either:

----
$ ./a.out /usr/share/icons/hicolor/64x64/apps/virtualbox.png 
Error reading PNG image /usr/share/icons/hicolor/64x64/apps/virtualbox.png: out of memory
----

So patching cairo might still be necessary for some other apps to work correctly.
Comment 2 Ben de Groot (RETIRED) gentoo-dev 2013-04-13 06:05:36 UTC
+*fcitx-4.2.7-r1 (13 Apr 2013)
+
+  13 Apr 2013; Ben de Groot <yngwin@gentoo.org> +fcitx-4.2.7-r1.ebuild:
+  Apply fixed PNGs from upstream git commit to fix cairo/libpng-1.6 crash (bug
+  #465658)

Fcitx is now fixed, so what remains is the Cairo issue. Let's see how upstream wants to handle this.

Thanks for the detailed bug report and upstream follow-up!
Comment 3 Richard Grenville 2013-04-17 14:55:09 UTC
Fix on cairo side is now in its git repo, but it could take quite some time before it gets into a release ( 
http://cgit.freedesktop.org/cairo/commit/?id=2dd2c826a5b367d32cf2d48ed69754795990c5db ). Should the change be backported on Gentoo?
Comment 4 Samuli Suominen (RETIRED) gentoo-dev 2013-04-27 10:24:50 UTC
+*cairo-1.12.14-r2 (27 Apr 2013)
+
+  27 Apr 2013; Samuli Suominen <ssuominen@gentoo.org> +cairo-1.12.14-r2.ebuild,
+  +files/cairo-1.12.14-libpng16.patch:
+  Backport upstream compability patch for libpng16 wrt #465658 by Richard
+  Grenville