Random comments about the shared mime database

Eric van der Vlist vdv at dyomedea.com
Tue Nov 22 13:37:44 PST 2005


Hi,

Looking in more details to the CVS version of the shared mime database,
I have several comments/questions...

1) The glob for "application/x-tex-pk" doesn't include a dot:

  <mime-type type="application/x-tex-pk">
    <comment>packed font file</comment>
    <glob pattern="*pk"/>
  </mime-type>

Is that a typo or are really all filenames ending by "pk" supposed to be
packed fonts?

2) A lot of script files have 'application/x-executable' declared as a
super class:

  <mime-type type="text/x-python">
    <sub-class-of type='application/x-executable'/>
    <sub-class-of type="text/plain"/>

However, the magic numbers of application/x-executable seems to cover
only binary formats:

  <mime-type type="application/x-executable">
    <comment>executable</comment>
    <magic priority="40">
      <match type="string" value="\177ELF" offset="0">
        <match type="byte" value="1" offset="5">
          <match type="little16" value="2" offset="16"/>
        </match>
      </match>
      <match type="string" value="\177ELF" offset="0">
        <match type="byte" value="2" offset="5">
          <match type="big16" value="2" offset="16"/>
        </match>
      </match>
      <match type="string" value="MZ" offset="0"/>
      <match type="little16" value="0x521c" offset="0"/>
      <match type="host16" value="0420" offset="0"/>
      <match type="host16" value="0421" offset="0"/>
      <match type="little16" value="0603" offset="0"/>
    </magic>
    <glob pattern="*.exe"/>
  </mime-type>
 
The spec says that applications should test the magic of the supertypes
to detect if they are applicable to a document:

"Some types may or may not be instances of other types. For example, a
spreadsheet file may be compressed or not. It is a valid spreadsheet
file either way, but only inherits from application/x-gzip in one case.
This information cannot be represented statically; instead an
application interested in this information should run all of the magic
rules, and use the list of types returned as the subclasses. "

In that case, how can these magic rules be matched for scripts? And if
they are not matched, what's the point of defining
application/x-executable as a supertype for scripts?

3) Many XML formats do not have "text/xml" as a supertype. Is there a
drawback for adding this supertype to all the XML formats? 

Thanks,

Eric

-- 
Have you ever thought about unit testing XSLT templates?
                                                     http://xsltunit.org
------------------------------------------------------------------------
Eric van der Vlist       http://xmlfr.org            http://dyomedea.com
(ISO) RELAX NG   ISBN:0-596-00421-4 http://oreilly.com/catalog/relax
(W3C) XML Schema ISBN:0-596-00252-1 http://oreilly.com/catalog/xmlschema
------------------------------------------------------------------------




More information about the xdg mailing list