0.47 crashes when printing from command line (but not gui)

Bug #511361 reported by bcrowell on 2010-01-22
52
This bug affects 9 people
Affects Status Importance Assigned to Milestone
Inkscape
High
Unassigned

Bug Description

Inkscape 0.47pre4 crashes when I print any svg file from the command line like this:

========

 $ inkscape --print=">b.ps" b.svg

Emergency save activated!
Emergency save completed. Inkscape will close now.
If you can reproduce this crash, please file a bug at www.inkscape.org
with a detailed description of the steps leading to the crash, so we can fix it.
** Message: Error: Inkscape encountered an internal error and will close now.

Segmentation fault

=========

I've attached a sample file that produces the crash, but it doesn't seem to be dependent on the file.

$ inkscape --version
Inkscape 0.47pre4 r22446 (Oct 15 2009)
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 9.10
Release: 9.10
Codename: karmic

The local is standard US.

Command-line printing used to work for me. Since then, I've upgraded the OS (from ubuntu jaunty to ubuntu karmic) and inkscape (to 0.47).

bcrowell (launchpadcrowell07) wrote :
bcrowell (launchpadcrowell07) wrote :

$ gdb /usr/bin/inkscape
GNU gdb (GDB) 7.0-ubuntu
Copyright (C) 2009 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 /usr/bin/inkscape...(no debugging symbols found)...done.
(gdb) run --print=">b.ps" b.svg
Starting program: /usr/bin/inkscape --print=">b.ps" b.svg
[Thread debugging using libthread_db enabled]

Program received signal SIGSEGV, Segmentation fault.
0x00000000005b22f4 in ?? ()
(gdb) bt
#0 0x00000000005b22f4 in ?? ()
#1 0x0000000000480ef3 in ?? ()
#2 0x000000000045378e in ?? ()
#3 0x0000000000454b39 in ?? ()
#4 0x0000000000452419 in ?? ()
#5 0x00007fffeff71abd in __libc_start_main () from /lib/libc.so.6
#6 0x0000000000451619 in ?? ()
#7 0x00007fffffffe8c8 in ?? ()
#8 0x000000000000001c in ?? ()
#9 0x0000000000000003 in ?? ()
#10 0x00007fffffffeb7a in ?? ()
#11 0x00007fffffffeb8c in ?? ()
#12 0x00007fffffffeb9a in ?? ()
#13 0x0000000000000000 in ?? ()
(gdb)

bcrowell (launchpadcrowell07) wrote :

I've checked that the crash also occurs with the latest version from SVN. See below. (I don't understand why the version number of today's SVN checkout is *lower* than the version number distributed with ubuntu karmic...?)

$ /usr/local/bin/inkscape --version
Inkscape 0.46+devel r22653 (Jan 22 2010)
$ /usr/local/bin/inkscape --print=">b.ps" b.svg

Emergency save activated!
Emergency save completed. Inkscape will close now.
If you can reproduce this crash, please file a bug at www.inkscape.org
with a detailed description of the steps leading to the crash, so we can fix it.
** Message: Error: Inkscape encountered an internal error and will close now.

Segmentation fault
$ gdb /usr/local/bin/inkscape
GNU gdb (GDB) 7.0-ubuntu
Copyright (C) 2009 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 /usr/local/bin/inkscape...done.
(gdb) run --print=">b.ps" b.svg
Starting program: /usr/local/bin/inkscape --print=">b.ps" b.svg
[Thread debugging using libthread_db enabled]

Program received signal SIGSEGV, Segmentation fault.
Inkscape::Extension::Extension::get_param_string (this=0x0, name=0xa8db2a "destination", doc=0x0, node=0x0) at extension/extension.cpp:430
430 param = param_shared(name, parameters);
(gdb) bt
#0 Inkscape::Extension::Extension::get_param_string (this=0x0, name=0xa8db2a "destination", doc=0x0, node=0x0) at extension/extension.cpp:430
#1 0x000000000047d603 in sp_print_document_to_file (doc=0x13e4f00, filename=0x107e030 ">b.ps") at print.cpp:157
#2 0x000000000044fa3e in sp_process_file_list (fl=0x104cd60) at main.cpp:996
#3 0x0000000000450de9 in sp_main_console (argc=3, argv=0x7fffffffe8c8) at main.cpp:1139
#4 0x000000000044e6c9 in main (argc=3, argv=<value optimized out>) at main.cpp:685

bcrowell (launchpadcrowell07) wrote :

The problem appears to be that the function Extension::get_param_string() at line 426 in extension.cpp expects three arguments, but the function sp_print_document_to_file() in print.cpp is calling it at line 157 with one. This single line in print.cpp seems to be the only place where get_param_string() is ever even called.

Alvin Penner (apenner) wrote :

could you try this command and see if it helps?

inkscape --export-ps="test2.ps" test2.svg

bcrowell (launchpadcrowell07) wrote :

I checked, and the crash only occurs with --print, not with --export-ps. The functionality is not exactly equivalent, however. With --print, I can go directly to a pipe. And it seems like a documented feature should not crash :-)

Alvin Penner (apenner) wrote :

confirmed. I've never used this option before, but on my machine it appears to work normally on Oct 13, 2008 SVN rev 19989, and it crashes on Nov 20, 2008, SVN rev 20225

Changed in inkscape:
status: New → Confirmed
su_v (suv-lp) on 2010-01-23
tags: added: cli crash printing
Changed in inkscape:
importance: Undecided → High
Bernard Bou (bbou) wrote :

Same here:
Inkscape 0.47pre4 r22446 (Oct 14 2009)

Berenger81 (sergio-feo) wrote :

Still broken:
Inkscape 0.47 r22583 (Apr 4 2010)

Lars Kruse (devel-sumpfralle) wrote :

Sadly the same problem exists here in Debian testing (0.47-2). Thus there is currently no way to let inkscape write its output to stdout. This is a pity, regarding its otherwise great commandline interface. I would really appreciate a fix for this bug!

@bcrowell: Compared to other occourences of "param_get_string" the function call in src/print.cpp looks ok.

./extension/internal/emf-win32-print.cpp: gchar const *utf8_fn = mod->get_param_string("destination");
./extension/internal/emf-win32-inout.cpp: oldconst = mod->get_param_string("destination");
./extension/internal/latex-pstricks.cpp: fn = mod->get_param_string("destination");
./extension/internal/cairo-renderer-pdf-out.cpp: new_exportId = mod->get_param_string("exportId");
./extension/internal/latex-pstricks-out.cpp: oldconst = mod->get_param_string("destination");
./extension/internal/cairo-ps-out.cpp: new_exportId = mod->get_param_string("exportId");
./extension/internal/cairo-ps-out.cpp: new_exportId = mod->get_param_string("exportId");
./print.cpp: oldconst = mod->get_param_string("destination");

Sadly I don't have sufficient processing ressources to triage the introduction of the segfault between the aforementioned r19989 and r20225 within a resonable time (a build takes hours with my machine). Would anybody be willing to dig into this issue?

Thanks for you time!
Cheers,
Lars

su_v (suv-lp) wrote :

Also present in BZR head (reproduced with Inkscape 0.47 and 0.48+devel r9669 on OS X 10.5.8)

no related console messages except:
Bus error

summary: - 0.47pre4 crashes when printing from command line (but not gui)
+ 0.47 crashes when printing from command line (but not gui)
su_v (suv-lp) wrote :

I'm not sure, but from the backtrace in comment #3 the segfault seems to be in
430 param = param_shared(name, parameters);

<http://bazaar.launchpad.net/~inkscape.dev/inkscape/trunk/annotate/head%3A/src/extension/extension.cpp#L370>
which does not seem to have any relevant changes between SVN r19989 and r20225 (BZR r6885 and r6891 - unfortunately the bzr revision log doesn't help here (two big merges))

SVN revisions:
<http://inkscape.svn.sourceforge.net/viewvc/inkscape?view=revision&revision=19989>
<http://inkscape.svn.sourceforge.net/viewvc/inkscape?view=revision&revision=20225>

BZR revisions (~same time frame i.e. change set includes the same files as SVN revisions above)
<http://bazaar.launchpad.net/%7Einkscape.dev/inkscape/trunk/revision/6885>
<http://bazaar.launchpad.net/%7Einkscape.dev/inkscape/trunk/revision/6891>

Lars Kruse (devel-sumpfralle) wrote :

I used access to a faster machine to do look for the problematic revision.

The first revision exposing the segfault seems to be r20191.

From the svn log:
 remove old ps exporter, obsoleted by cairo ps export

The relevant diff seems to be the following (but maybe I am wrong) in src/extension/init.cpp:
- Internal::PrintPS::init();

This is the point, where I don't know enough about the inkscape code to continue this research.
Maybe someone else can take a look at the issue?

Cheers,
Lars

bcrowell (launchpadcrowell07) wrote :

This bug is still present in Inkscape 0.48.

jazzynico (jazzynico) wrote :

Updated GDB trace (Crunchbang Waldorf, Inkscape trunk revision 13446):
----
Program received signal SIGSEGV, Segmentation fault.
Inkscape::Extension::Extension::get_param (this=0x0, name=0xc1e77b "destination") at extension/extension.cpp:409
409 if (this->parameters == NULL) {
(gdb) bt
#0 Inkscape::Extension::Extension::get_param (this=0x0, name=0xc1e77b "destination") at extension/extension.cpp:409
#1 0x0000000000652749 in get_param (name=<optimized out>, this=<optimized out>) at extension/extension.cpp:433
#2 Inkscape::Extension::Extension::get_param_string (this=<optimized out>, name=<optimized out>, doc=0x0, node=0x0)
    at extension/extension.cpp:438
#3 0x0000000000524dc6 in sp_print_document_to_file (doc=0x1c44ea0, filename=0x13127a0 ">b.ps") at print.cpp:99
#4 0x000000000047914e in sp_process_file_list (fl=0x1276130) at main.cpp:1152
#5 0x000000000047a688 in sp_main_console (argc=3, argv=0x7fffffffe478) at main.cpp:1344
#6 0x00007fffeefb3ead in __libc_start_main () from /lib/x86_64-linux-gnu/libc.so.6
#7 0x0000000000477dc1 in _start ()

Changed in inkscape:
status: Confirmed → Triaged
jazzynico (jazzynico) wrote :

Interesting comment in src/extension/internal/cairo-render-context.cpp (line 343 ):
---
    /* TODO: Replace the below fprintf's with something that does the right thing whether in
    * gui or batch mode (e.g. --print=blah). Consider throwing an exception: currently one of
    * the callers (sp_print_document_to_file, "ret = mod->begin(doc)") wrongly ignores the
    * return code.
    */

Daniel McCloy (drammock) wrote :

I can confirm what I think is the same bug on version:
0.48.4 r9939 (Jan 22 2014)

In my case, it was an accidental discovery, as I was intending to do an SVG > PNG conversion, but accidentally passed the print (-p) flag instead of the export-png (-e) flag:

$ inkscape -f test.svg -p test.png
Emergency save activated!
Emergency save completed. Inkscape will close now.
If you can reproduce this crash, please file a bug at www.inkscape.org
with a detailed description of the steps leading to the crash, so we can fix it.
** Message: Error: Inkscape encountered an internal error and will close now.

Segmentation fault (core dumped)

Waldir Pimenta (waldyrious) wrote :

This still happens in Inkscape 0.91 r13725 (Oct 2 2015).

According to https://bbs.archlinux.org/viewtopic.php?id=134659, updating gtk2 to 2.24.9-2 may help, but YMMV.

Waldir Pimenta (waldyrious) wrote :

I've just confirmed, I do have gtk+-2.24.29 in my system (OSX 10.10) and the command still segfaults, so again, regarding the suggestion above, YMMV.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers