GNOME Bugzilla – Bug 664269
Can't open ".war" format since 3.2 (java)
Last modified: 2012-02-08 18:11:48 UTC
this report has been filed here: https://bugs.launchpad.net/ubuntu/+source/file-roller/+bug/877256 File-roller is not opening the war files "I just right clicked the war and selected the option "Open with Archive manager"." "Whenever I try to open any war files with the archive manager, I only get the following error message. "Could not open "FILE_NAME.war" Archive type not supported." https://bugs.launchpad.net/ubuntu/+source/file-roller/+bug/877256/+attachment/2559339/+files/sample.war "my nautilus says its MIME type is 'application/x-webarchive'. I've tried "grep -r '-war' /usr/share/mime", but it seems to take forever to process it. So I did "grep -r '[.]war' /usr/share/mime" instead and got the following result. /usr/share/mime/packages/kde.xml: <glob pattern="*.war"/> /usr/share/mime/application/x-webarchive.xml: <glob pattern="*.war"/> /usr/share/mime/globs:application/x-webarchive:*.war /usr/share/mime/globs2:50:application/x-webarchive:*.war and "grep -r '[.]war' ~/.local" gave me the following result (I excluded binary ones). /home/kevinsh/.local/share/recently-used.xbel: <bookmark href="file:///home/kevinsh/Desktop/test/sample.war" added="2011-11-02T18:55:07Z" modified="2011-11-02T18:55:07Z" visited="2011-11-02T18:55:07Z"> /home/kevinsh/.local/share/recently-used.xbel: <bookmark href="file:///home/kevinsh/Desktop/sample.war" added="2011-11-14T17:36:23Z" modified="2011-11-14T17:36:23Z" visited="2011-11-14T17:36:24Z">" "does it happen without kdelibs5-data? do all the users having that issue have kdelibs installed?" "kdelib5-data defines the mimetype as: " <mime-type type="application/x-webarchive"> <sub-class-of type="application/x-compressed-tar"/> <sub-class-of type="application/x-gzip"/> <!-- only necessary because x-compressed-tar is not specifying this sub-class-of (shared-mime-info 0.8) --> <comment>web archive</comment> <glob pattern="*.war"/> </mime-type>" it's a subtype of zip but that doesn't seem to be enough to make file-roller happy "
A workaround is to rename it with a .zip extension, open it, make edits, confirm an update to the archive, then remove the .zip extension. It's a workaround, but having done it maybe fifty times a day for the last few days, the bug is a tedious regression.
I cannot reproduce this problem. I don't have the x-webarchive mime type on my system (ArchLinux), Nautilus says that a .war file is of type applicazion/zip. Anyway this shoudn't be a problem because file-roller uses magic numbers to identify a zip archive as such despite its file extension. At the moment I have no idea why this doesn't work for you.
Thanks Paolo, can you give hints to debug it? Steps to reproduce it on ubuntu - create a .local/share/mime/packages/x-webarchive.xml "<?xml version="1.0" encoding="UTF-8"?> <mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info"> <mime-type type="application/x-webarchive"> <sub-class-of type="application/x-compressed-tar"/> <sub-class-of type="application/x-gzip"/> <!-- only necessary because x-compressed-tar is not specifying this sub-class-of (shared-mime-info 0.8) --> <comment>web archive</comment> <glob pattern="*.war"/> </mime-type> </mime-info>" - run update-mime-database ~/local/share/mime - restart nautilus - click on a .war (the one in the bug description download for example) you get the issue...
(In reply to comment #3) > Thanks Paolo, can you give hints to debug it? > add a breakpoint here: http://git.gnome.org/browse/file-roller/tree/src/fr-archive.c?h=gnome-2-32#n1135 and see what mime type is returned. > Steps to reproduce it on ubuntu > > - create a .local/share/mime/packages/x-webarchive.xml > > "<?xml version="1.0" encoding="UTF-8"?> > <mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info"> > <mime-type type="application/x-webarchive"> > <sub-class-of type="application/x-compressed-tar"/> > <sub-class-of type="application/x-gzip"/> <!-- only necessary because > x-compressed-tar is not specifying this sub-class-of (shared-mime-info 0.8) --> > <comment>web archive</comment> > <glob pattern="*.war"/> > </mime-type> > </mime-info>" > > - run update-mime-database ~/local/share/mime > - restart nautilus > - click on a .war (the one in the bug description download for example) > > you get the issue... I still cannot reproduce the problem following these steps, in this case file-roller uses the magic numbers to get the application/zip mime type and it will open the file as a zip archive.
Thanks, that's useful. Did you try to open from nautilus? The file-roller.desktop uses "Exec=file-roller %U" Indeed calling file-roller ./example.war works but file-roller file:///dir/example.war doesn't work and load_local_archive() is not called, it's probably not considering "file:" as local?
ignore the previous comment that was a local error
ok, I got why it's happening in the Ubuntu build, the package is using the same options as Debian and "--enable-magic", is that not recommended nowadays? it only happens when using that
" if (! create_command_to_load_archive (archive, mime_type)) { mime_type = get_mime_type_from_magic_numbers (archive->local_copy); if (! create_command_to_load_archive (archive, mime_type)) {" the mimetype returned there is "application/zip; charset=binary" when libmagic is used which is an incorrect mimetype (that's using libmagic 5.09), the code should probably strip the string to ";"
Sebastien, this should be fixed now in current master, can you test it please?
Thanks a lot Paolo, that indeed fixes it and similar bugs we had about .apk or .xpi for example