← Back to team overview

desktop-packages team mailing list archive

[Bug 926019] Re: gdk-pixbuf fails to recognize svg file with long comments at top

 

*** This bug is a duplicate of bug 872967 ***
    https://bugs.launchpad.net/bugs/872967

** Tags added: rls-w-incoming

-- 
You received this bug notification because you are a member of Desktop
Packages, which is subscribed to gdk-pixbuf in Ubuntu.
https://bugs.launchpad.net/bugs/926019

Title:
  gdk-pixbuf fails to recognize svg file with long comments at top

Status in GDecrypt:
  New
Status in gdk-pixbuf package in Ubuntu:
  Confirmed

Bug description:
  In precise, the current gdecrypt package doesn't work.  It crashes
  with this error:

  Traceback (most recent call last):
    File "./main.py", line 609, in <module>
      gdc = gdecrypt()
    File "./main.py", line 127, in __init__
      pixbuf128 = gtk.icon_theme_get_default().load_icon("gdecrypt",128,0)
  glib.GError: Unrecognized image file format

  I checked, and it is attempting to load
  /usr/share/icons/hicolor/scalable/apps/gdecrypt.svg and failing.

  The file loads up just fine in eog and inkscape, and appears to be perfectly a valid svg.  In Python, you can try to load it directly:
  $ cd /usr/share/icons/hicolor/scalable/apps
  $ python
  >>> import gtk
  >>> gtk.gdk.pixbuf_new_from_file("gdecrypt.svg")
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
  glib.GError: Couldn't recognize the image file format for file 'gdecrypt.svg'
  >>> gtk.gdk.pixbuf_get_file_info("gdecrypt.svg")
  >>> gtk.gdk.pixbuf_get_file_info("gnome-panel.svg")
  ({'is_writable': False, 'extensions': ['svg', 'svgz', 'svg.gz'], 'mime_types': ['image/svg+xml', 'image/svg', 'image/svg-xml', 'image/vnd.adobe.svg+xml', 'text/xml-svg', 'image/svg+xml-compressed'], 'name': 'svg', 'description': 'Scalable Vector Graphics'}, 48, 48)

  Comparing the two leads to one important difference.  gnome-panel.svg starts with:
  <?xml version="1.0" encoding="UTF-8" standalone="no"?>
  <!-- Created with Inkscape (http://www.inkscape.org/) -->
  <svg
  ...

  gdecrypt.svg, on the other hand:
  <?xml version="1.0" encoding="UTF-8" standalone="no"?>
  <!-- Created with Inkscape (http://www.inkscape.org/) -->
  <!-- Copyright (C) 2007  Kjell Braden
        Permission is granted to copy, distribute and/or modify this
        document under the terms of the GNU General Public License,
        Version 3 or any later version published by the Free Software
        Foundation. -->
  <svg
  ...

  If the copyright notice is removed, the icon loads just fine and
  everything works.  However, the comment is well-formed and there's
  nothing I'm aware of forbidding svg files from containing comments of
  any length ahead of the document root tag.  As such, it is not
  generally safe to use MIME magic that only looks at the beginning of
  the file to detect the svg format.  I have no suggestions as to how to
  solve this in the general case, but I suspect that it is what is
  happening here, and there's no good reason not to use the file
  extension to determine the type of the icon right here.

  While I ran into this in trying out gdecrypt, I believe this is
  clearly a gdk-pixbuf issue that is merely negatively affecting that
  package, so I'm filing this bug against the latter package.

To manage notifications about this bug go to:
https://bugs.launchpad.net/gdecrypt/+bug/926019/+subscriptions