Crashes when Invert filter is called from CLI

Bug #1185391 reported by Raphael
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
New
Undecided
Unassigned

Bug Description

I try to invert colors in a PDF. The intended workflow is:

 1. convert to SVG by `inkscape -l file.svg file.pdf`
 2. invert colors in the SVG
 3. reconvert to PDF

For the second step, I use the command

    inkscape file.svg --without-gui \
      --verb=EditSelectAllInAllLayers \
      --verb=org.inkscape.color.negative.noprefs \
      --verb=FileSave \
      --verb=FileClose

This terminates without effect. Dropping `--without-gui`, Inkscape starts, begins to apply the filter, shows the result (behind the dialog) and then crashes.

Here is the output of `gdb` including backtrace (using a minimal failing command):

program: /usr/bin/inkscape input_0001.svg --verb=org.inkscape.color.negative
    [Thread debugging using libthread_db enabled]
    Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
    [New Thread 0x7fffe3c5f700 (LWP 2336)]
    [New Thread 0x7fffe345e700 (LWP 2337)]
    [New Thread 0x7fffda42e700 (LWP 2338)]

    Program received signal SIGSEGV, Segmentation fault.
    0x00000000007cf157 in Inkscape::Extension::Implementation::Script::effect(Inkscape::Extension::Effect*, Inkscape::UI::View::View*, Inkscape::Extension::Implementation::ImplementationDocumentCache*) ()
    (gdb) bt
    #0 0x00000000007cf157 in Inkscape::Extension::Implementation::Script::effect(Inkscape::Extension::Effect*, Inkscape::UI::View::View*, Inkscape::Extension::Implementation::ImplementationDocumentCache*) ()
    #1 0x0000000000b55c3d in Inkscape::Extension::ExecutionEnv::run() ()
    #2 0x00000000007ca06c in Inkscape::Extension::Effect::effect(Inkscape::UI::View::View*) ()
    #3 0x00000000007ca1b5 in Inkscape::Extension::Effect::prefs(Inkscape::UI::View::View*) ()
    #4 0x000000000080e302 in sp_action_perform(SPAction*, void*) ()
    #5 0x00000000006855bc in Inkscape::CmdLineAction::doList(Inkscape::UI::View::View*) ()
    #6 0x0000000000685609 in Inkscape::CmdLineAction::idle() ()
    #7 0x00007ffff6e9b392 in ?? ()
       from /usr/lib/x86_64-linux-gnu/libglibmm-2.4.so.1
    #8 0x00007ffff4476d53 in g_main_context_dispatch ()
       from /lib/x86_64-linux-gnu/libglib-2.0.so.0
    #9 0x00007ffff44770a0 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
    #10 0x00007ffff447749a in g_main_loop_run ()
       from /lib/x86_64-linux-gnu/libglib-2.0.so.0
    #11 0x00007ffff5d882f7 in gtk_main ()
       from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
    #12 0x000000000065e010 in sp_main_gui(int, char const**) ()
    #13 0x0000000000643468 in main ()

Note that it works if I start Inkscape, load the file, select all (CTRL+A) and then execute the filter by selecting Filters -> Color -> Invert.

It also works if I use an SVG generated with Inkscape directly. A PDF that causes the crash (after conversion, see above) is appended.

I have Inkscape 0.48.3.1 r9886 (Jan 29 2013). My OS is Ubuntu 12.04 with kernel 3.2.0-43-generic on x86_64.

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

1) Verbs & GUI

> For the second step, I use the command
>
> inkscape file.svg --without-gui \
[…]
> This terminates without effect. Dropping `--without-gui`, Inkscape starts, begins
> to apply the filter, shows the result (…)

As mentioned in the manual [1], verbs used on the command line cannot be run without GUI ( see also bug #843260).

2) Difference in used test cases

Please note that

> --verb=org.inkscape.color.negative.noprefs \

and

> and then execute the filter by selecting Filters -> Color -> Invert.

are not the same: the first one runs a python-based extension which modifies the RGB values of fill/stroke colors in the selection (Extensions > Color > Negative), the second one applies a filter effect (Effects > Color > Invert). When applying a filter effect, the actual color properties of objects in the selection are not modified - SVG filter effects only affect the rendering (rasterization, output) of the filtered objects (or of objects inside filtered containers, like layers or groups).

To find the verb for applying the filter effect 'Color > Invert' use
$ inkscape --verb-list | grep -i invert

(Hint: verbs for filter effects are named 'org.inkscape.effect.filter.*')

3) Known regression in 0.48.3.1

The reported crash when running the extension 'Color > Negative' (this crash happens on the command line as well as when using the GUI) is a known regression in Inkscape 0.48.3.1, already tracked in

- Bug #944077 “inkscape crashed with SIGSEGV in Inkscape::Extension::Implementation::Script::effect()”
  <https://bugs.launchpad.net/inkscape/+bug/944077>

Workaround for affected files:
  <https://bugs.launchpad.net/ubuntu/+source/inkscape/+bug/944077/comments/11>

Note that the trigger (id string for <namedview> element) is e.g. present when opening PDF/PS/EPS files in Inkscape, as described in
  <https://bugs.launchpad.net/ubuntu/+source/inkscape/+bug/944077/comments/10>

Applying a filter effect is not affected by the regression in Inkscape 0.48.3.1 tracked in bug #944077.

Proposing to link this report (bug #1185391) as duplicate to bug #944077.

-----
[1] <http://tavmjong.free.fr/INKSCAPE/MANUAL/html/CommandLine.html>

tags: added: extensions-plugins
removed: cli filters-svg
Revision history for this message
Raphael (akerbos) wrote :

Thank you for that elaborate reply and help, @~suv!

Ad 1) Okay, that *is* annoying. Hope that this will be changed/fixed in the future.

Ad 2) Thanks for the explanation and pointer towards the filter (which works nicely). I checked a list of verbs in some wiki ( http://how-to.wikia.com/wiki/How_to_use_Inkscape_in_commandline_mode/List_of_verbs ) which is apparently far from complete; I will use `--verb-list` directly in the future.

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

Linking as duplicate to bug #944077 - please add a comment here (bug #1185391) and revert the duplicate status if you disagree or have additional information indicating that the underlying causes for the crash are not the same.

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.