/usr/share/mime/icons is empty, causes wrong file icons

Bug #279911 reported by Krzysztof Kosinski
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
shared-mime-info (Ubuntu)
New
Medium
Unassigned

Bug Description

Binary package hint: shared-mime-info

According to this:
http://standards.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-latest.html
The file /usr/share/mime/icons should contain a list of mimetypes and their associated icon names. However, currently this file only lists custom overrides defined by the user in <icon> elements.

GIO uses this file via xdgmime to find the icons for files in e.g. Nautilus. XDG icons always override the default icon name that is obtained by substituting slashes in the mimetype name with hyphens. This causes wrong behavior - if a given file type has a generic icon assigned, it always overrides the specific mimetype icons, e.g. application-x-rar will show up as package-x-generic even though there is an icon for application-x-rar in the current theme. To prevent this, all mimetypes should have their icons listed in /usr/share/mime/icons.

Here is a patch for update-mime-database that writes the default icon names (obtained by substituting slashes for hyphens) to the aforementioned file, thereby causing the right icons to show up and fixing this regression from Hardy. This bug was first reported as bug #278113 and incorrectly marked as a duplicate of an unrelated problem with icon theme inheritance.

Revision history for this message
Krzysztof Kosinski (tweenk) wrote :
description: updated
Revision history for this message
Sebastien Bacher (seb128) wrote :

Thank you for your bug report and work on this issue. The bug is an upstream one though and it would be nice to discuss it on bugs.freedesktop.org so it can be fixed properly upstream rather than changed in a distribution specific way, could you open a bug there too and add a bug watch on launchpad?

Changed in shared-mime-info:
importance: Undecided → Medium
Revision history for this message
Krzysztof Kosinski (tweenk) wrote :

I noticed an additional problem, and fundamentally it is a design problem in the xdgmime library. The order in which icons should be checked is as follows:

- XDG icon specified by the user
- specific mimetype icon
- legacy specific mimetype icon (gnome-mime-...)
- XDG generic icon
- foo-x-generic

The problem is that there is no way to tell what we actually get from XDG - whether it is an user override or a generic icon. My fix will unfortunately cause XDG generic icons to always be ignored, beacuse the name from the generic-icons file is only returned if there's no name defined in the icons file. I don't know how to fix this properly yet, but I'll work on this.

Revision history for this message
Krzysztof Kosinski (tweenk) wrote :

The correct fix for this is not to write everything to /usr/share/mime/icons, which effectively disables /usr/share/mime/generic-icons when used with the current GLib code, but rather to fix the code in GLib which uses the wrong fallback order. See bug #280867 for a fix. You can mark this report as a duplicate of that bug.

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.