Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-44846

QMimeDatabase: MIME detection issues with magics in MIME hierarchies with same glob pattern



    • Type: Bug
    • Status: Open
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 5.4.1
    • Fix Version/s: None
    • Component/s: Core: Other
    • Labels:


      I didn't find a good title

      Consider the following MIME definitions:

      <?xml version="1.0" encoding="UTF-8"?>
      <mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
          <!-- The real life example would be that this mime type is a sub class of application/xml
               which has a magic that matches &lt;?xml .
               XML files with an early appearing qnx tag are detected as
               application/vnd.qnx.bar-descriptor. We want that XML files without the qnx tag to be
               identified as application/xml, independent of the order in which the two are registered. -->
          <mime-type type="application/vnd.qnx.bar-descriptor">
            <sub-class-of type="application/foo"/>
            <glob pattern="*.foo"/>
            <magic><!-- higher priority than the parent magic -->
              <match value="&lt;qnx&gt;" type="string" offset="0:200"/>
          <mime-type type="application/foo">
            <glob pattern="*.foo"/>
            <magic priority="40">
              <match value="&lt;?foo" type="string" offset="0"/>

      and the following file something.foo


      Both MIME types match by pattern. Magic is consulted, application/foo matches by magic. Currently, the resulting MIME type is application/vnd.qnx.bar-descriptor because that appears first in the list and is a subclass of the MIME type that matches by magic.


        For Gerrit Dashboard: QTBUG-44846
        # Subject Branch Project Status CR V



            • Assignee:
              con Eike Ziller
              con Eike Ziller
            • Votes:
              0 Vote for this issue
              1 Start watching this issue


              • Created:

                Gerrit Reviews

                There are no open Gerrit changes