Bug 160875 - WISH: add CPIO support
Summary: WISH: add CPIO support
Status: RESOLVED FIXED
Alias: None
Product: ark
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: NOR wishlist
Target Milestone: ---
Assignee: Harald Hvaal
URL:
Keywords:
Depends on:
Blocks: 192630
  Show dependency treegraph
 
Reported: 2008-04-15 20:22 UTC by Jaan Vajakas
Modified: 2010-11-10 04:23 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.6.0


Attachments
Split libarchive_kerfuffle.desktop into two .desktop files (3.26 KB, patch)
2010-11-08 04:32 UTC, Raphael Kubo da Costa
Details
Splits the kerfuffle_libarchive.desktop in two files, and adds the cpio mime types to the readonly version. (2.27 KB, application/octet-stream)
2010-11-08 13:14 UTC, George Metaxas
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jaan Vajakas 2008-04-15 20:22:49 UTC
Version:            (using KDE 4.0.3)
Installed from:    SuSE RPMs
OS:                Linux

It would be very nice if at least extracting CPIO archives were supported.
I guess after adding RPM support (#60942, another wish I voted for) it should be easy.
Comment 1 Olivier Trichet 2008-04-25 19:44:53 UTC
could you add :

   application/x-cpio;application/x-cpio-compressed;

and the end of the "MimeType=...." line in the file /usr/share/kde4/services/kerfuffle_libarchive.desktop (maybe it is placed elsewhere on you system).
Then ark should be able to open cpio archive.
Could you test a few cpio archives and report if it works for you too ?
Comment 2 Jaan Vajakas 2008-05-01 21:51:32 UTC
Yes, now it opens CPIO archives but when I try to extract some files from a CPIO archive it says "Extraction discarding paths is not supported yet."
Comment 3 George Metaxas 2010-11-04 12:00:50 UTC
I had a look at this bug report, and after adding: application/x-cpio;application/x-cpio-compressed; and the end of the "MimeType=...." in the file kerfuffle_libarchive.desktop, I was able to open cpio archives and extract files from it. I think that libarchive's support of cpio files must have been updated, so this bug could be closed?
Comment 4 Raphael Kubo da Costa 2010-11-07 04:16:30 UTC
Hmm, have you checked different cpio formats? According to libarchive-formats(5) there are at least 3 different cpio formats it supports.

The libarchive plugin code differs tar files and compressed tar files (and the different compression formats, such as gz or bz2), but does not do anything special with cpio files -- I'd like to spend some time playing with libarchive's test suite to check if we support all cpio files it does.
Comment 5 George Metaxas 2010-11-07 20:51:06 UTC
I had a look at the different cpio formats, and it seems that libarchive supports reading all of them, and writing using the odc POSIX format (mentioned in the libarchive-formats). 
I created files for each one of the different formats supported by the cpio utility (v2.11), plus one gzipped cpio. I added the five different mimes types to the kerfuffle_libarchive.desktop file (x-bcpio, x-cpio, x-cpio-compressed, x-sv4cpio, x-sv4crc). For all files, including the gzipped compressed cpio file, ark would read and display their contents. Moreover, ark managed to extract the files and folders of all cpio archives that I tested. 
Creating cpio archives, or adding files to an existing cpio archive, however, requires changes to the ark code. But reading the archives, can be pushed into the trunk very quickly. 
I tested this feature with libarchive v2.7.1.
Comment 6 Raphael Kubo da Costa 2010-11-08 04:32:15 UTC
Created attachment 53232 [details]
Split libarchive_kerfuffle.desktop into two .desktop files

Thanks a lot for the investigation.

Can you apply this patch locally, add the CPIO mimetypes to kerfuffle_libarchive_readonly.desktop and see if everything still works?

As we need to write more code to support creating CPIO archives, this patch splits kerfuffle_libarchive.desktop into a desktop file with a list of mimetypes we can read and write to, and another one with a list of mimetypes we can only read. For now, the CPIO mimetypes should be in the read-only list.
Comment 7 Raphael Kubo da Costa 2010-11-08 04:33:22 UTC
Oh, and remember that whenever you install the new .desktop files you will need to run kbuildsycoca4.
Comment 8 George Metaxas 2010-11-08 13:14:29 UTC
Created attachment 53242 [details]
Splits the kerfuffle_libarchive.desktop in two files, and adds the cpio mime types to the readonly version.
Comment 9 George Metaxas 2010-11-08 13:15:56 UTC
Comment on attachment 53242 [details]
Splits the kerfuffle_libarchive.desktop in two files, and adds the cpio mime types to the readonly version.

Applied your patch, added the mime types, repeated the tests, and it's working. I am attaching this patch, which is the original patch, plus the cpio mime types.
Comment 10 Raphael Kubo da Costa 2010-11-10 04:21:55 UTC
SVN commit 1194909 by rkcosta:

Add the CPIO mimetypes to the list of mimetypes Ark supports.

In order to do that, kerfuffle_libarchive.desktop has been split into
two desktop files.

One of them, kerfuffle_libarchive.desktop, contains a MimeType entry
with all the mimetypes which we can read _and_ write. The other one,
kerfuffle_libarchive_readonly.desktop, contains the list of mimetypes
we can open read-only.

For now, we also move the mimetypes for Debian packages and ISO files
to the list of mimetypes we can only read. Debian packages are
actually CPIO archives, so it should be moved back to
kerfuffle_libarchive.desktop when we implement write support for CPIO
archives in general.

Thanks to George Metaxas for bringing this issue up again :)

BUG: 160875

 M  +1 -1      CMakeLists.txt  
 M  +1 -1      kerfuffle_libarchive.desktop  
 A             kerfuffle_libarchive_readonly.desktop  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1194909