I'm pasting from http://bugzilla.gnome.org/show_bug.cgi?id=136071 (which has two
different patches to solve the problem)
« The attached patch fixes a bug with the xdgmime code where any elf
executable file would be sniffed as an application/x-core file. This
happens because of a bug in xdgmimemagic.c when the magic for a mime
type is composed of several 'indented' patterns.
xdgmimemagic.c reads the patterns one by one, and each time it has read
one pattern, it prepends them at the beginning of a list. With a file
<match .... /> <- indent 0
<match ....> <- indent 0
<match ....> <- indent 1
<match ... /> <- indent 2
you'd have in memory a list composed of
(pattern with indent 2), (pattern with indent 1), (pattern with indent
0), (pattern with indent 0)
On the other hand, the code in _xdg_mime_magic_matchlet_compare_level
assumes that the list it processes contains the parsed indented patterns
in the same order as the magic file, which caused the misdetection of
the mime type of those elf executables.
I fixed that by mirroring the list of patterns, the place where I'm
doing it may not be appropriate, but files in /bin are now properly
identified as executable files. »
Created attachment 118 [details] [review]
I committed this patch to gnome-vfs HEAD. So far it works fine on my two systems.