Testing xdg-mime on large number of files
Сергей Давыдов
shnatsel at gmail.com
Tue Sep 25 12:52:47 PDT 2012
Hello XDG people,
I've discovered some files which were not recognized by xdg-mime unless
they have a correct extension; after filing a bug against shared-mime-info
I wondered if I have any other files that are not recognized and how can I
check that. I wrote a shell script for automatic testing, and it worked
pretty well: after feeding at about 150,000 files to it I've discovered
five more unrecognized file groups and reported bugs about them. I'm now
sharing the script to simplify large-scale testing of shared-mime-info
database, you can find it attached to this email. I hope this will help
improve shared-mime-info database.
The script accepts only one parameter: the directory in which to look for
files. The directory will be walked recursively. The script works by
hardlinking* the files into a temporary directory without extensions and
comparing xdg-mime output for both files. If the mimetype becomes
"application/octet-stream", it considers the file unrecognized and outputs
its name and original mimetype to a file; if the mimetype changes but has
no "octet-stream" in it, it considers the mimetype incompletely detected
and writes out the file name to another file along with the normal and
magic-based mimetypes as reported by xdg-mime.
*xdg-mime is clever - it follows symlinks and uses the name of the actual
file for matching, so I had to use hard links instead of symbolic.
Cheers,
--
Sergey "Shnatsel" Davidoff
P.S. I'm re-sending this message because it got bounced while I was not
subscribed to the list. Sorry if you receive a duplicate eventually.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/xdg/attachments/20120925/790e7f16/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test-xdg-mime-matching.sh
Type: application/x-sh
Size: 2608 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/xdg/attachments/20120925/790e7f16/attachment.sh>
More information about the xdg
mailing list