Bug 207517

Summary: kde thinks jar files are zip archives
Product: [Applications] systemsettings Reporter: John Tamoras <skotadopsyxos>
Component: kcm_filetypesAssignee: David Faure <faure>
Status: RESOLVED DOWNSTREAM    
Severity: normal CC: f.alexander.wilms, faure, kdelibs-bugs
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Ubuntu   
OS: Unspecified   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description John Tamoras 2009-09-16 00:00:22 UTC
Version:            (using KDE 4.3.1)
Installed from:    Ubuntu Packages

kde reports on the properties of jar files that they are zip archives, it actually reports the file as a generic *.zip archive.
There is *.jar rule in the system settings which points that those files should be treated as java execs but it is not followed. In fact there isn't even an "open with" pointing to java in the right click menu for the jar files.
Comment 1 David Faure 2009-09-17 14:05:28 UTC
Hmm. It's Sun's fault :-)

packages/sun-java5-jre.xml defines
       <mime-type type="application/java-archive">
              <comment>Java Archive</comment>
              <glob pattern="*.jar"/>
       </mime-type>
while packages/freedesktop.org.xml defines
<mime-type type="application/x-java-archive">
with the same glob *.jar

Which makes *.jar conflicting, and then only sniffing (determination from the contents) can be used to disambiguate it. I'll check why the sniffing doesn't work, and why sun-java5-jre redefines the mimetype.....
Comment 2 David Faure 2009-09-17 14:07:05 UTC
Workaround for now: as root, remove /usr/share/mime/packages/sun-java*-jre.xml and run update-mime-database /usr/share/mime.
Comment 3 David Faure 2009-09-17 15:37:55 UTC
It's a debian/ubuntu packaging bug rather than a Sun bug, in fact.

https://bugs.launchpad.net/ubuntu/+source/krusader/+bug/309778
Comment 4 John Tamoras 2009-09-17 17:12:50 UTC
Thanks, the workaround worked. My question is though, as you marked it as resolved and reading your comments, shouldn't the KDE desktop have it's own rules that "disobey" those at mime/packages and only use them as reference? I mean from my system settings I had already removed the duplicate entry and still didn't read it right..
Comment 5 David Faure 2009-09-17 17:40:16 UTC
We won't include a workaround in KDE, that would be a bit dirty when the right fix is upstream (I just added the missing alias to shared-mime-info btw).

But I think you mean "disabling a mimetype as a user". That's another story ;-)
You tried removing the *.jar mimetype from one of the mimetypes? If you don't have shared-mime-info from CVS this won't work (try reopening that mimetype, you'll see that the glob is back). https://bugs.kde.org/show_bug.cgi?id=203706
I ping'ed Bastien yesterday to ask for a shared-mime-info release so that this finally works for everyone.
Comment 6 Alexander Wilms 2022-11-28 18:42:38 UTC
*** Bug 458520 has been marked as a duplicate of this bug. ***
Comment 7 Alexander Wilms 2022-11-28 18:53:55 UTC
This is still an issue in openSUSE Tumbleweed 20221127. Is it still accurate that this is a packaging issue? And if so, wouldn't it make sense to include the workaround in KDE since several distros seem to have this problem?

alexander@PC:/usr/share/mime> find . -name "*java*"  
./text/x-java.xml
./application/x-java-archive.xml
./application/x-java-jce-keystore.xml
./application/x-java.xml
./application/x-java-pack200.xml
./application/javascript.xml
./application/x-java-jnlp-file.xml
./application/x-java-applet.xml
./application/x-java-keystore.xml
./video/x-javafx.xml

alexander@PC:/usr/share/mime> grep -r "\.jar" *
application/x-java-archive.xml:  <glob pattern="*.jar"/>
globs:application/x-java-archive:*.jar
globs2:50:application/x-java-archive:*.jar
packages/freedesktop.org.xml:    <glob pattern="*.jar"/>

Contents of /usr/share/mime/application/x-java-archive.xml and packages/freedesktop.org.xml:

[...]
  <sub-class-of type="application/zip"/>
  <generic-icon name="package-x-generic"/>
  <alias type="application/x-jar"/>
  <alias type="application/java-archive"/>
  <glob pattern="*.jar"/>
[...]
Comment 8 Alexander Wilms 2022-11-28 19:02:28 UTC
Downstream bug report:

https://bugzilla.opensuse.org/show_bug.cgi?id=1205825