After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 664269 - Can't open ".war" format since 3.2 (java)
Can't open ".war" format since 3.2 (java)
Status: RESOLVED FIXED
Product: file-roller
Classification: Applications
Component: general
3.2.x
Other Linux
: Normal normal
: ---
Assigned To: Paolo Bacchilega
file-roller-maint
Depends on:
Blocks:
 
 
Reported: 2011-11-17 13:17 UTC by Pedro Villavicencio
Modified: 2012-02-08 18:11 UTC
See Also:
GNOME target: ---
GNOME version: 3.1/3.2



Description Pedro Villavicencio 2011-11-17 13:17:09 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
"
Comment 1 Jamie Jackson 2012-01-12 07:54:36 UTC
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.
Comment 2 Paolo Bacchilega 2012-01-12 10:06:51 UTC
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.
Comment 3 Sebastien Bacher 2012-01-26 22:44:21 UTC
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...
Comment 4 Paolo Bacchilega 2012-02-05 10:53:36 UTC
(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.
Comment 5 Sebastien Bacher 2012-02-07 21:08:11 UTC
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?
Comment 6 Sebastien Bacher 2012-02-07 21:19:17 UTC
ignore the previous comment that was a local error
Comment 7 Sebastien Bacher 2012-02-07 21:21:57 UTC
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
Comment 8 Sebastien Bacher 2012-02-07 21:34:06 UTC
"		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 ";"
Comment 9 Paolo Bacchilega 2012-02-08 16:35:44 UTC
Sebastien,

this should be fixed now in current master, can you test it please?
Comment 10 Sebastien Bacher 2012-02-08 18:11:48 UTC
Thanks a lot Paolo, that indeed fixes it and similar bugs we had about .apk or .xpi for example