Segmentation fault when converting a particular SVG file to PNG

Bug #962941 reported by robitaille on 2012-03-23
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
Medium
Unassigned

Bug Description

If I try and convert the attached file (arc_ellipse.svg) as a PNG file, I get a segmentation fault:

---

$ inkscape -z arc_ellipse.svg --export-png arc_ellipse_svg.png
Background RRGGBBAA: ffffff00
Area 0:0:720:540 exported to 720 x 540 pixels (90 dpi)
Bitmap saved as: arc_ellipse_svg.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: 11

---

I do not see this error with other files, so it does not appear to be an installation problem.

My configuration is:

MacOS 10.7.3
Inkscape 0.48.2 r9819 (Mar 20 2012)

Inkscape was installed via MacPorts

If I run inkscape in the debugger, the issue does not occur:

---

(gdb) run -z arc_ellipse.svg --export-png arc_ellipse_svg.png
Starting program: /opt/local/bin/inkscape -z arc_ellipse.svg --export-png arc_ellipse_svg.png
Reading symbols for shared libraries ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++........
...................................................................................................................................................... done
Reading symbols for shared libraries . done
Background RRGGBBAA: ffffff00
Area 0:0:720:540 exported to 720 x 540 pixels (90 dpi)
Bitmap saved as: arc_ellipse_svg.png

Program exited normally.

---

robitaille (thomas-robitaille) wrote :
su_v (suv-lp) wrote :

Crash not reproduced with
- Inkscape 0.48.2 (MacPorts), 0.48.3.1 and 0.48+devel r11116 on OS X 10.7.2, Gtk+/X11 2.24.10
- Inkscape 0.48.2 (MacPorts) on Mac OS X 10.5.8, Gtk+/X11 2.24.8
- Inkscape 0.48.3.1 (MacPorts, local repo) and 0.48+devel r11116 on Mac OS X 10.5.8 (i386), Gtk+/Quartz 2.24.10
using the same command as detailed by the reporter (tested both with usual preferences, and with default settings ('~/.config/inkscape' moved aside)).

> $ inkscape -z arc_ellipse.svg --export-png arc_ellipse_svg.png

AFAICT that's not really the correct syntax btw - see 'inkscape --help'. Could you test with
$ inkscape arc_ellipse.svg --export-png=arc_ellipse_svg.png
or
$ inkscape arc_ellipse.svg -e arc_ellipse_svg.png
or
$ inkscape -f arc_ellipse.svg -e arc_ellipse_svg.png

Note: '-z' is not explicitly needed for exporting to bitmap via command line (it is assumed for -p, -e, -l, and --vacuum-defs options).

tags: added: cli crash
robitaille (thomas-robitaille) wrote :

Your comment regarding .config/inkscape prompted me to see what happened if I removed .config/inkscape before running. Here's what happens (the various flags you suggested don't affect things):

---

$ rm -r ~/.config/inkscape

$ rm arc_ellipse_svg.png

$ inkscape arc_ellipse.svg --export-png arc_ellipse_svg.png
Background RRGGBBAA: ffffff00
Area 0:0:720:540 exported to 720 x 540 pixels (90 dpi)
Bitmap saved as: arc_ellipse_svg.png

$ rm arc_ellipse_svg.png

$ inkscape arc_ellipse.svg --export-png arc_ellipse_svg.png
Background RRGGBBAA: ffffff00
Area 0:0:720:540 exported to 720 x 540 pixels (90 dpi)
Bitmap saved as: arc_ellipse_svg.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: 11

---

So basically the first time it runs after removing .config/inkscape, it works fine, then it crashes if .config/inkscape already exists. In fact, I can be more specific. If I remove preferences.xml, then it works fine, but then crashes the second time, when preferences.xml already exists. In fact, let's be even more specific. If I remove the following line from preferences.xml:

    <group id="autosave" enable="0" interval="10" path="" max="10"/>

Then I have no issue. Let me know if there is any other information I can provide to track down this bug!

robitaille (thomas-robitaille) wrote :

I decided to do further tests, and created a new (clean) user to ensure that all my environment variables aren't affecting things, and I no longer reproduce the above .config/inkscape related issues. Instead, I always get:

---

$ inkscape arc_ellipse.svg --export-png test.png

(process:29293): Gtk-WARNING **: Locale not supported by C library.
 Using the fallback 'C' locale.
Background RRGGBBAA: ffffff00
Area 0:0:720:540 exported to 720 x 540 pixels (90 dpi)
Bitmap saved as: test.png

** (inkscape:29293): CRITICAL **: bool sp_png_write_rgba_striped(SPDocument*, const gchar*, long unsigned int, long unsigned int, double, double, int (*)(const guchar**, int, int, void*), void*): assertion `fp != NULL' failed

---

the first time I run inkscape, and

---

$ inkscape arc_ellipse.svg --export-png test.png

(process:29384): Gtk-WARNING **: Locale not supported by C library.
 Using the fallback 'C' locale.
Background RRGGBBAA: ffffff00
Area 0:0:720:540 exported to 720 x 540 pixels (90 dpi)
Bitmap saved as: 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: 11

---

subsequently. If I remove .config/inkscape, I get the first error message again. I will test this on another machine to see if I can reproduce this.

robitaille (thomas-robitaille) wrote :

This sounds the same as the issue described here:

https://answers.launchpad.net/inkscape/+question/122236

which sounds like a permissions issue. I will investigate.

su_v (suv-lp) wrote :

Thanks for further investigating. Question 122236 seems unrelated: on OS X Lion, I can reproduce it with MacPorts' Inkscape 0.48.2 (unchanged Portfile, installed into custom PREFIX), but not with local builds from the 0.48.x branch and current trunk, nor with an old MacPorts build of Inkscape 0.48.2 on Mac OS X 10.5.8 (Intel) - (frozen MacPorts 1.9.2 tree, with manual updates of relevant Gtk+ ports).

Chillida:~ su_v$ ll arc_ellipse.svg
-rw-r--r--@ 1 su_v staff 44012 Mar 23 17:19 arc_ellipse.svg
Chillida:~ su_v$ rm -r ~/.config/inkscape
Chillida:~ su_v$ which inkscape
/Volumes/cyan/mp-test/with-a-long-long-long-directory-name/bin/inkscape
Chillida:~ su_v$ inkscape -V
Inkscape 0.48.2 r9819 (Dec 21 2011)
Chillida:~ su_v$ inkscape -f arc_ellipse.svg -e arc_ellipse_svg.png
Background RRGGBBAA: ffffff00
Area 0:0:720:540 exported to 720 x 540 pixels (90 dpi)
Bitmap saved as: arc_ellipse_svg.png
Chillida:~ su_v$ grep autosave ~/.config/inkscape/preferences.xml
    <group id="autosave" enable="0" interval="10" path="" max="10"/>
Chillida:~ su_v$ inkscape -f arc_ellipse.svg -e arc_ellipse_svg.png
Background RRGGBBAA: ffffff00
Area 0:0:720:540 exported to 720 x 540 pixels (90 dpi)
Bitmap saved as: arc_ellipse_svg.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: 11
Chillida:~ su_v$ grep autosave ~/.config/inkscape/preferences.xml
    <group id="autosave" enable="0" interval="10" path="" max="10"/>
Chillida:~ su_v$ alias ink048x
alias ink048x='/Volumes/cyan/src/inkscape/inkscape-0.48.x/inst/bin/inkscape'
Chillida:~ su_v$ ink048x -V
Inkscape 0.48.3.1 r9886 (Feb 22 2012)
Chillida:~ su_v$ ink048x -f arc_ellipse.svg -e arc_ellipse_svg.png
Background RRGGBBAA: ffffff00
Area 0:0:720:540 exported to 720 x 540 pixels (90 dpi)
Bitmap saved as: arc_ellipse_svg.png
Chillida:~ su_v$ grep autosave ~/.config/inkscape/preferences.xml
    <group id="autosave" enable="0" interval="10" path="" max="10"/>
Chillida:~ su_v$ inkscape -f arc_ellipse.svg -e arc_ellipse_svg.png
Background RRGGBBAA: ffffff00
Area 0:0:720:540 exported to 720 x 540 pixels (90 dpi)
Bitmap saved as: arc_ellipse_svg.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: 11
Chillida:~ su_v$ alias inkttt
alias inkttt='XDG_CACHE_HOME="$HOME/.cache-mp-test" /Volumes/cyan/src/inkscape/inkscape-repo/mp-test/inst/bin/inkscape'
Chillida:~ su_v$ inkttt -V
Inkscape 0.48+devel r11119 custom (Mar 23 2012)
Chillida:~ su_v$ inkttt -f arc_ellipse.svg -e arc_ellipse_svg.png
Background RRGGBBAA: ffffff00
Area 0:0:720:540 exported to 720 x 540 pixels (90 dpi)
Bitmap saved as: arc_ellipse_svg.png
Chillida:~ su_v$

su_v (suv-lp) wrote :

Also not reproduced using the latest official Inkscape.app package from sf.net (0.48.2-1-SNOWLEOPARD, 32bit, Universal PPC+i386) on the command line:

Chillida:~ su_v$ grep autosave ~/.config/inkscape/preferences.xml
    <group id="autosave" enable="0" interval="10" path="" max="10"/>
Chillida:~ su_v$ /Volumes/cyan/devel/Applications/Inkscape-0.48.2-1-SNOWLEOPARD/Inkscape-048_2-1-orig.app/Contents/Resources/script -f $HOME/arc_ellipse.svg -e $HOME/arc_ellipse_svg.png
Setting Language: .UTF-8
Background RRGGBBAA: ffffff00
Area 0:0:720:540 exported to 720 x 540 pixels (90 dpi)
Bitmap saved as: /Users/su_v/arc_ellipse_svg.png

robitaille (thomas-robitaille) wrote :

Sorry for all the comments. Ignore my comments number #4 and #5, those errors were related to permissions. Now I have fixed this, I can reproduce the issue with a new user:

$ rm -r ~/.config
radiant:inkscape test$ rm arc_ellipse_svg.png
rm: arc_ellipse_svg.png: No such file or directory
radiant:inkscape test$ inkscape arc_ellipse.svg --export-png arc_ellipse_svg.png

(process:29570): Gtk-WARNING **: Locale not supported by C library.
 Using the fallback 'C' locale.
Background RRGGBBAA: ffffff00
Area 0:0:720:540 exported to 720 x 540 pixels (90 dpi)
Bitmap saved as: arc_ellipse_svg.png
radiant:inkscape test$ inkscape arc_ellipse.svg --export-png arc_ellipse_svg.png

(process:29571): Gtk-WARNING **: Locale not supported by C library.
 Using the fallback 'C' locale.
Background RRGGBBAA: ffffff00
Area 0:0:720:540 exported to 720 x 540 pixels (90 dpi)
Bitmap saved as: arc_ellipse_svg.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: 11

robitaille (thomas-robitaille) wrote :

For the clean user, I have to remove all of these groups from the preferences.xml file for things to work:

<group id = "whiteboard">
  <group id = "server" name = "jabber.org" port = "5222" username = "" ss$
  <group id = "room" name = "inkboard" server = "gristle.org"/>
</group>

<group id="desktop" style="">
  <group
     width="640"
     height="480"
     x="0"
     y="0"
     fullscreen="0"
     id="geometry" />
  <group
     id="XYfront" />
  <group
     id="XYrear" />
  <group
     id="XZtop" />
  <group
     id="XZbottom" />
  <group
     id="YZleft" />
  <group
     id="YZright" />
</group>

<group id="ui"
language=""/>

<group
   id="toolbox"
   icononly="1"
   secondary="1"
   small="1">
  <group
     id="tools"
     icononly="1"
     small="0" />
</group>

<group id="autosave" enable="0" interval="10" path="" max="10"/>

<group id="debug">
  <group id="latency" skew="1"/>
</group>

<group id="threading" numthreads="1"/>

<group id="extensions"> </group>

<group id="devices">
</group>

I'm not really sure what's going on, but it's interesting that things work properly if the preferences.xml file does not exist

robitaille (thomas-robitaille) wrote :

So just to be clear, you *can* reproduce the error on MacPorts' Inkscape 0.48.2 on Lion?

su_v (suv-lp) wrote :

> So just to be clear, you *can* reproduce the error on MacPorts' Inkscape 0.48.2 on Lion?

Yes, but only with that build (based on MacPorts' current port file):
Chillida:~ su_v$ port file inkscape
/Volumes/cyan/mp-test/with-a-long-long-long-directory-name/var/macports/sources/rsync.macports.org/release/tarballs/ports/graphics/inkscape/Portfile
Chillida:~ su_v$ port installed inkscape
The following ports are currently installed:
  inkscape @0.48.2_2+python27 (active)
Chillida:~ su_v$

Latest crash report (with backtrace) attached.

The other builds on Lion are 64bit as well and use the same dependencies installed via MacPorts, but have been compiled from source (outside of MacPorts).

robitaille (thomas-robitaille) wrote :

Ok - since you can reproduce the issue, let me know if I can provide any additional information, or whether the matter is now with the developers.

su_v (suv-lp) wrote :

Setting status to confirmed for now - it's odd though that apparently only the builds compiled with MacPorts' internal build environment [1] on Lion expose this kind of crash.

Original Portfile:
<https://trac.macports.org/browser/trunk/dports/graphics/inkscape/Portfile>

[1] A new test build of 0.48.2 based on a modified Portfile (new 'minimal' variant added without any of the custom python-related configure settings and patches) also crashes.

Changed in inkscape:
status: New → Confirmed
tags: added: osx
su_v (suv-lp) wrote :

Can't reproduce the crash with current inkscape installed via MacPorts anymore:
<https://trac.macports.org/browser/trunk/dports/graphics/inkscape?rev=117894>

@robitaille - any chance you could repeat the tests with up-to-date MacPorts on your system (if you have the port still installed and activated)?

Changed in inkscape:
importance: Undecided → Medium
status: Confirmed → Incomplete
su_v (suv-lp) wrote :

Closing - no further feedback whether the issue persists with later builds of Inkscape via MacPorts.

Please reopen the report if it was closed prematurely and the same kind of crash can be reproduced with current builds (port inkscape or inkscape-devel).

Changed in inkscape:
status: Incomplete → Invalid
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers