Masking in the MIME magic spec
Thomas Kluyver
thomas at kluyver.me.uk
Sun Mar 10 05:51:41 PDT 2013
The spec [1] says that the mask is applied to the value from the file
before comparing it with the value from the magic database.
However, looking for examples, I find image/vnd.adobe.photoshop [2], where
bytes 5-6 of the mask are \x00\x00, while bytes 5-6 of the value are
\x20\x20 (two spaces). By my reading, the test is therefore [value & 0x0000
== 0x2020], which can never be true.
It looks like the mask should be applied to both the value from the file
and the value in the magic database, so where the mask is \x00, the magic
value is ignored. This appears to be what xdgmime does [3]. Is this
correct, and is it worth updating the spec to clarify it?
Thanks,
Thomas
[1]
http://standards.freedesktop.org/shared-mime-info-spec/latest/ar01s02.html#id2597284
[2]
http://cgit.freedesktop.org/xdg/shared-mime-info/tree/freedesktop.org.xml.in#n4523
[3] http://cgit.freedesktop.org/xdg/xdgmime/tree/src/xdgmimemagic.c#n536
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/xdg/attachments/20130310/9cc019c1/attachment.html>
More information about the xdg
mailing list