Comment 10 for bug 309778

Revision history for this message
David Faure (faure) wrote :

Reported in KDE as https://bugs.kde.org/show_bug.cgi?id=207517, but this is indeed a debian/ubuntu bug. There's no reason for /usr/share/mime/packages/sun-java6-jre.xml to exist, it only redefines what freedesktop.org.xml already defines, and with another mimetype name.
That file should be removed from the package.

The reason the accuracy is low is that there's a conflict on the *.jar glob, when both application/java-archive (from packages/sun-java5-jre.xml) and application/x-java-archive (from freedesktop.org.xml) are associated with it. So kmimetypefinder doesn't really know which one to choose. To help deciding that it does mimetype sniffing (looking at the contents), and that says application/zip - because the magic for jar files seems wrong/incomplete.

freedesktop.org.xml says
    <magic priority="85">
      <match value="PK\003\004" type="string" offset="0">
        <match value="0xcafe" type="host16" offset="40"/>
      </match>
    </magic>
but although I see PK\003\004 in all jar files (the zip header), I don't see 0xcafe at offset 40. Does someone know of a proper way to recognize a jar file from its contents?

Anyway all this seems to come from the missing application/java-archive alias for application/x-java-archive in freedesktop.org.xml (it should have been defined as an alias, not as a conflicting glob, in the xml file...). That mimetype name has NOT been registered to IANA, so in theory it should have a x- prefix, but well, it seems commonly used that way so I think I can add it to shared-mime-info.