Linking color profile from Document properties dialog crashes Inkscape (rev >= 13107)

Bug #1291546 reported by Vladimir Savic
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
High
jazzynico

Bug Description

If one tries to link color profile using dedicated tab of Document properties dialog Inkscape crashes. The same happens if, as I did, and provided backtrace reflects that particular situation, one has custom "default.svg" file in local templates directory.

Here's a backtrace of Inkscape r13139 crashing:

    GNU gdb (GDB) 7.6.1-ubuntu
    Copyright (C) 2013 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law. Type "show copying"
    and "show warranty" for details.
    This GDB was configured as "x86_64-linux-gnu".
    For bug reporting instructions, please see:
    <http://www.gnu.org/software/gdb/bugs/>...
    Reading symbols from /home/vladimir/Sources/inkscape_install/bin/inkscape...done.
    (gdb) run
    Starting program: /home/vladimir/Sources/inkscape_install/bin/./inkscape
    [Thread debugging using libthread_db enabled]
    Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
    [New Thread 0x7fffe6636700 (LWP 2547)]
    [New Thread 0x7fffe5e35700 (LWP 2548)]
    terminate called after throwing an instance of 'std::logic_error'
      what(): basic_string::_S_construct null not valid

    Program received signal SIGABRT, Aborted.
    0x00007ffff02faf77 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
    56 ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
    (gdb) bt
    #0 0x00007ffff02faf77 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
    #1 0x00007ffff02fe5e8 in __GI_abort () at abort.c:90
    #2 0x00007ffff0e236e5 in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #3 0x00007ffff0e21856 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #4 0x00007ffff0e21883 in std::terminate() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #5 0x00007ffff0e21aae in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #6 0x00007ffff0e72ed7 in std::__throw_logic_error(char const*) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #7 0x00007ffff5f4f249 in char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&, std::forward_iterator_tag) () from /usr/lib/x86_64-linux-gnu/libcairomm-1.0.so.1
    #8 0x00007ffff0e7ea58 in std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #9 0x00000000005d4593 in Inkscape::URI::getFullPath (this=this@entry=0x7fffffffd790, base=...) at uri.cpp:152
    #10 0x0000000000486886 in Inkscape::ColorProfile::set (this=0x1619580, key=<optimized out>, value=<optimized out>)
        at color-profile.cpp:342
    #11 0x0000000000486695 in Inkscape::ColorProfile::build (this=0x1619580, document=0x1c6dea0, repr=<optimized out>)
        at color-profile.cpp:283
    #12 0x00000000005951aa in SPObject::invoke_build (this=0x1619580, document=0x1c6dea0, repr=0x1c6ba30,
        cloned=<optimized out>) at sp-object.cpp:720
    #13 0x00000000005972a8 in SPObject::build (this=0x276eef0, document=0x1c6dea0, repr=<optimized out>)
        at sp-object.cpp:660
    #14 0x00000000005951aa in SPObject::invoke_build (this=0x276eef0, document=0x1c6dea0, repr=0x1c6bb20,
        cloned=<optimized out>) at sp-object.cpp:720
    #15 0x00000000005972a8 in SPObject::build (this=this@entry=0x276db50, document=document@entry=0x1c6dea0,
        repr=repr@entry=0x1c6bc10) at sp-object.cpp:660
    #16 0x0000000000573fae in SPItem::build (this=this@entry=0x276db50, document=document@entry=0x1c6dea0,
        repr=repr@entry=0x1c6bc10) at sp-item.cpp:400
    #17 0x00000000005852c9 in SPLPEItem::build (this=this@entry=0x276db50, document=document@entry=0x1c6dea0,
        repr=repr@entry=0x1c6bc10) at sp-lpe-item.cpp:68
    #18 0x0000000000576e09 in SPGroup::build (this=this@entry=0x276db50, document=document@entry=0x1c6dea0,
        repr=repr@entry=0x1c6bc10) at sp-item-group.cpp:83
    #19 0x00000000005a333c in SPRoot::build (this=0x276db50, document=0x1c6dea0, repr=0x1c6bc10) at sp-root.cpp:87
    #20 0x00000000005951aa in SPObject::invoke_build (this=0x276db50, document=0x1c6dea0, repr=0x1c6bc10,
        cloned=<optimized out>) at sp-object.cpp:720
    #21 0x00000000004a8a80 in SPDocument::createDoc (rdoc=rdoc@entry=0x1c53840, uri=uri@entry=0x0, base=base@entry=0x0,
        name=name@entry=0x2763d70 "New document 1", keepalive=keepalive@entry=1, parent=parent@entry=0x0)
        at document.cpp:385
    #22 0x00000000004a96ee in SPDocument::createNewDoc (uri=0x0, keepalive=keepalive@entry=1,
        make_new=make_new@entry=true, parent=parent@entry=0x0) at document.cpp:556
    #23 0x00000000004c1515 in sp_file_new (templ=...) at file.cpp:131
    ---Type <return> to continue, or q <return> to quit---
    #24 0x00000000004c1a22 in sp_file_new_default () at file.cpp:224
    #25 0x0000000000475186 in sp_main_gui (argc=1, argv=0x7fffffffde78) at main.cpp:1071
    #26 0x00007ffff02e5de5 in __libc_start_main (main=0x4596b0 <main(int, char**)>, argc=1, ubp_av=0x7fffffffde78,
        init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffde68)
        at libc-start.c:260
    #27 0x0000000000471b2f in _start ()
    (gdb)

Revision history for this message
su_v (suv-lp) wrote :

Reroduced with r13135 on OS X 10.7.5

Based on tests with archived builds:
- not reproduced with rev <= 13104,
- reproduced with rev >= 13107;
this regression was likely introduced with the removal of 'src/dom' in r13107:
<http://bazaar.launchpad.net/~inkscape.dev/inkscape/trunk/changes/13107>
<http://bazaar.launchpad.net/~inkscape.dev/inkscape/trunk/revision/13107>

tags: added: color crash regression
Changed in inkscape:
importance: Undecided → High
milestone: none → 0.91
status: New → Confirmed
Revision history for this message
su_v (suv-lp) wrote :

Full backtrace with r13135 on OS X 10.7.5 (GTK+/X11).

tags: added: blocker
Revision history for this message
su_v (suv-lp) wrote :

Adding 'blocker' tag - this prevents trunk from launching at all, if the user has a custom template with a linked color profile.

su_v (suv-lp)
summary: Linking color profile from Document properties dialog crashes Inkscape
+ (rev >= 13107)
Revision history for this message
jazzynico (jazzynico) wrote :

Also reproduced on Crunchbang Waldorf, rev. 13149.
Note that it crashes with a new, unsaved document, but not when linking a profile in an existing document.

Changed in inkscape:
status: Confirmed → Triaged
Revision history for this message
jazzynico (jazzynico) wrote :

It seems that NULL (const gchar *) paths are not correctly converted to empty strings.
Patch attached.

Changed in inkscape:
assignee: nobody → jazzynico (jazzynico)
Revision history for this message
jazzynico (jazzynico) wrote :
Revision history for this message
su_v (suv-lp) wrote :

Testing patch with r13154 on OS X 10.7.5:

If compiled with lcms1 (unfortunately still default for OS X builds, see bug #1024344 and bug #1133014) I now get error messages from lcms:
a) on opening a new document based on a template with a linked color profile:
   lcms: Error #12288; File '' not found
b) on opening a file with a linked color profile (e.g. the template itself):
   lcms: Error #12288; Corrupted profile: '/Users/su_v/.config-default/inkscape/templates/1291546-color-profile-from-Library.svg'

The linked profile however does exist at the location (absolute path) stored in the <defs> section, and is not corrupted AFAIK: There are no such messages with archived build r13104 using lcms1 (not affected by the regression reported here), and no such messages with a patched build of r13154 which uses lcms2.

$ grep -A 3 \<color-profile$ ~/.config-default/inkscape/templates/1291546-color-profile-from-Library.svg
    <color-profile
       name="Fogra27L-CMYK-Coated-Press"
       xlink:href="/Users/su_v/Library/ColorSync/Profiles/Fogra27L.icm"
       id="color-profile3262" />
$ ll ~/Library/ColorSync/Profiles/Fogra27L.icm
-rw-r--r-- 1 su_v staff 225824 Oct 15 2010 /Users/su_v/Library/ColorSync/Profiles/Fogra27L.icm
$

Revision history for this message
jazzynico (jazzynico) wrote :

> lcms: Error #12288; File '' not found
> lcms: Error #12288; Corrupted profile: '/Users/su_v/.config-default/inkscape/templates/1291546-color-profile-from-Library.svg'

Reproduced on Crunchbang Waldorf, with lcms2-dev removed.

In the trunk cmsOpenProfileFromFile() tries to open the document path instead of the profile path:

Trunk
-----
** Message: Escaped: /home/nicolas/.local/share/color/icc/is330.icm
** Message: docbase:
lcms: Error #12288; File '' not found
** Message: cmsOpenProfileFromFile( ''...) = (nil)
** Message: <color-profile> name set to 'RICOH-RUSSIAN-SC-040402'

** Message: Escaped: /home/nicolas/.local/share/color/icc/kodak_dc.icm
** Message: docbase:/home/nicolas/dev/Test/lcmstest.svg
lcms: Error #12288; Corrupted profile: '/home/nicolas/dev/Test/lcmstest.svg'
** Message: cmsOpenProfileFromFile( '/home/nicolas/dev/Test/lcmstest.svg'...) = (nil)
** Message: <color-profile> name set to 'KODAK-DC-Series-Digital-Camera'
-----

0.48.x
-----
** Message: Escaped: /home/nicolas/.local/share/color/icc/is330.icm
** Message: docbase:
** Message: cmsOpenProfileFromFile( '/home/nicolas/.local/share/color/icc/is330.icm'...) = 0x8e4bc00
** Message: <color-profile> name set to 'RICOH-RUSSIAN-SC-040402'

** Message: Escaped: /home/nicolas/.local/share/color/icc/kodak_dc.icm
** Message: docbase:/home/nicolas/dev/Test/lcmstest.svg
** Message: cmsOpenProfileFromFile( '/home/nicolas/.local/share/color/icc/kodak_dc.icm'...) = 0x8b1a000
** Message: <color-profile> name set to 'KODAK-DC-Series-Digital-Camera'
-----

Revision history for this message
jazzynico (jazzynico) wrote :

Some progress.
In 0.48.x ,"docUri.resolve(hrefUri);" returns the profile path (from hrefUri) according the the base path (from docUri).
In the trunk, is has been replaced with "docUri.getFullPath(hrefUri.getFullPath(""));" that gives the opposite result (a base path according to the profile path).

Inverting docUri and hrefUri seems to fix the issue with lcms (not tested with lcms2).
Note that the fix in uri.cpp is still needed to return an empty string when the base path is empty (unsaved new document).

New patch in progress, as well as new tests with lcms2.

Changed in inkscape:
status: Triaged → In Progress
Revision history for this message
jazzynico (jazzynico) wrote :

New patch, tested on Crunchbang Waldorf, Inkscape trunk revision 13163, with liblcms and liblcms2.

Revision history for this message
su_v (suv-lp) wrote :

Patch tested successfully with r13163 on OS X 10.7.5 with lcms 1.19 and lcms2 2.5.

Revision history for this message
jazzynico (jazzynico) wrote :

Fix committed revision 13165.
Thanks for your help, ~suv!

Changed in inkscape:
milestone: 0.91 → none
status: In Progress → Fix Released
Revision history for this message
su_v (suv-lp) wrote :

Minor details (r13248, OS X 10.7.5):
- lcms (1.19): Inkscape no longer outputs the path to the profile on the console if the file is missing (File '' not found) - the path and file name could be useful information for the user when editing files originally created on a different system).
- lcms2 (2.4): no console messages about missing profile on load at all; using the (missing) linked profile in Fill&Stroke results in a crash (in cmsDoTransform()). I don't have archived builds nor debug builds on OS X which use lcms2, and can't tell how it used to work before r13107 and r13165.

Revision history for this message
su_v (suv-lp) wrote :

re crashes with lcms2 and missing linked color profile: the crash (in cmsDoTransform()) also happens with stable 0.48.4 and trunk on Ubuntu 13.10 (VM, 64bit) -> unless I just missed to find an existing report, this ought to be tracked in a new report.

su_v (suv-lp)
tags: removed: blocker
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.