gdk-pixbuf fails to recognize svg file with long comments at top
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
GDecrypt |
New
|
Undecided
|
Unassigned | ||
gdk-pixbuf (Ubuntu) |
Confirmed
|
Undecided
|
Unassigned |
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_
glib.GError: Unrecognized image file format
I checked, and it is attempting to load /usr/share/
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/
$ python
>>> import gtk
>>> gtk.gdk.
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.
>>> gtk.gdk.
({'is_writable': False, 'extensions': ['svg', 'svgz', 'svg.gz'], 'mime_types': ['image/svg+xml', 'image/svg', 'image/svg-xml', 'image/
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://
<svg
...
gdecrypt.svg, on the other hand:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://
<!-- 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.
tags: | added: rls-w-incoming |
Status changed to 'Confirmed' because the bug affects multiple users.