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.

Attachment: test-xdg-mime-matching.sh
Description: Bourne shell script

_______________________________________________
xdg mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/xdg

Reply via email to