shared-mime-info test program: mimebreaker
david at davemalcolm.demon.co.uk
david at davemalcolm.demon.co.uk
Mon May 24 09:05:04 EEST 2004
In the hope of improving the shared-mime-info database, I've written a
test program that reads a freedestop.org.xml file, and tries to generate byte sequences that will match multiple sniff patterns.
In the default build it spits out all pairs of mimetypes containing
<match> elements for which it can generate a file matching both. You
can also give it a list of mimetypes, and it will try to generate an
example of a file matching all of those mimetypes to stdout. There are
other modes which can find n-way intersections, write xml reports of the
problems encountered, and which will fill directories with examples of
ambiguous files, though at the moment you have to hack the source to get
at these.
Currently it ignores the priorities and any bitmasks, so it's cheating
somewhat. It also assumes that no two <glob> patterns will match, so it
might miss some possible ambiguities where they do. The code is a
rather crude mixture of C++ and the STL, glib, and libxml2, but it seems
to work; there may be bugs, and I may have misinterpreted the spec.
The code can be downloaded here:
http://www.davemalcolm.demon.co.uk/mimebreaker/mimebreaker-0.1.tar.gz
Dave Malcolm
More information about the xdg
mailing list