Bug 355955

Summary: Ark is unable to determine the archive type for .tar files created with --format=v7
Product: [Applications] ark Reporter: Mario Aichinger <aichingm>
Component: generalAssignee: Raphael Kubo da Costa <rakuco>
Status: RESOLVED FIXED    
Severity: minor CC: elvis.angelaccio
Priority: NOR    
Version First Reported In: 15.08.3   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In: 15.12.0
Sentry Crash Report:

Description Mario Aichinger 2015-11-26 17:34:54 UTC
Ark is not able to select the right type for tar archives created in the format v7 (for information about the format take a look at the section: Old-Style Archive Format of https://www.freebsd.org/cgi/man.cgi?query=tar&sektion=5).

Instead of opening the archive, ark opens a dialog which gives the user the opportunity to select the type of archive which would in this case be "Tar Archive".

This happens for archives created with bsdtar and tar (gnu tar) as long as the option "--format=v7" is used. 

Besides the dialog ark writes to stdout: --> see "Actual Results"





Reproducible: Always

Steps to Reproduce:
1. # cd /tmp
2. # mkdir tarTest && cd tarTest
3. # echo "this is a test" > test.txt
4. # bsdtar --format=v7 -cf this_is_the_tar.tar test.txt
5. # ark this_is_the_tar.tar 


Actual Results:  
Ark opens a dialog in which it asks to select the type of archive (zip, tar,  ...).

And ark writes to stdout:

ark.kerfuffle: Mimetype for filename extension ( "application/x-tar" ) did not match mimetype for content ( "application/octet-stream" ). Using content-based mimetype.
ark.kerfuffle: Could not find a plugin to handle "/tmp/tarTest/this_is_the_tar.tar"


Expected Results:  
Ark should check the type of file to be opened and select the type itself. 

file resolves to the right file type

# file this_is_the_tar.tar
this_is_the_tar.tar: tar archive

# uname -a
Linux monster 4.2.5-1-ARCH #1 SMP PREEMPT Tue Oct 27 08:13:28 CET 2015 x86_64 GNU/Linux

# ark --version 
ark 15.08.3
Comment 1 Elvis Angelaccio 2015-11-27 10:45:03 UTC
Thanks for reporting. It looks like an issue with QMimeDatabase. I'll investigate whether it's an upstream bug.
Comment 2 Elvis Angelaccio 2015-11-28 10:00:49 UTC
Confirming. I just reported a bug against shared-mime-info: https://bugs.freedesktop.org/show_bug.cgi?id=93148

However, the issue above is about detection-by-content. Detection by extension works, so we could and should exploit it in Ark.
Comment 3 Elvis Angelaccio 2015-12-08 21:26:49 UTC
Git commit 3906648d1edcd56edee092ecd992d1366dadc31d by Elvis Angelaccio.
Committed on 08/12/2015 at 21:03.
Pushed by elvisangelaccio into branch 'Applications/15.12'.

Fix opening of archives whose mimetype cannot be detected-by-content

shared-mime-info 1.5 (and thus QMimeDatabase) cannot
detect-by-content tar archives created with the --format=v7 flag.
Instead of adding another exception (like we did for ISO files), let's just use
the mimetype detected from the extension if the one from content could not be
determined.
FIXED-IN: 15.12.0

M  +3    -2    kerfuffle/archive_kerfuffle.cpp

http://commits.kde.org/ark/3906648d1edcd56edee092ecd992d1366dadc31d