Bug 458908 - Cannot extract lz4 with single file inside
Summary: Cannot extract lz4 with single file inside
Status: RESOLVED FIXED
Alias: None
Product: ark
Classification: Applications
Component: plugins (show other bugs)
Version: 22.08.2
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Elvis Angelaccio
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-09-09 06:37 UTC by Kai Uwe Broulik
Modified: 2022-11-02 23:02 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 22.12.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kai Uwe Broulik 2022-09-09 06:37:34 UTC
Ark is unable to open or extract an lz4 archive with a single file inside, e.g. a coredump in form core.process.lz4.

It is able to open tar.lz4 archives just fine, however.

STEPS TO REPRODUCE
1. Try to open an lz4 compressed file

OBSERVED RESULT
"No handler for this format"

EXPECTED RESULT
I can view and extract the file inside

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: git master as of 2022-08-24
Qt Version: 5.15.5

ADDITIONAL INFORMATION
echo "foo" > bar
lz4 bar
Now try to open bar.lz4

Works fine in Engrampa.
Comment 1 Double Jumper 2022-10-19 21:37:54 UTC
Encountered this issue as well. The plugin responsible for providing support for .tar.lz4 archives is probably libarchive, but by default it doesn't support single files such as .lz4 or even .gz. It does however provide a Raw handler that supports those cases: https://github.com/libarchive/libarchive/wiki/FormatRaw
By adding that functionality, it could even make other plugins redundant, since it supports at least gzip, bzip2 and zstd.
Comment 2 Kai Uwe Broulik 2022-10-20 05:25:00 UTC
Yes, it's libarchive. There's a "single file" plug in using KArchive but that doesn't support lz4. Wonder if it would make sense to discontinue it in favor of libarchive raw handler.
Comment 3 Elvis Angelaccio 2022-10-26 21:40:33 UTC
I played a bit with the libarchive raw filter and it seems to work fine. There are a couple of quirks that need adjustments, but overall I believe we can use it and, indeed, drop the single-file plugin.

Btw this issue doesn't affect only lz4, but also all the other compression formats that are currently unsopported by KArchive (lzo, lzip, lrzip, ...)
Comment 4 Elvis Angelaccio 2022-10-30 18:08:16 UTC
(In reply to Elvis Angelaccio from comment #3)
> I played a bit with the libarchive raw filter and it seems to work fine.
> There are a couple of quirks that need adjustments, but overall I believe we
> can use it and, indeed, drop the single-file plugin.
> 
> Btw this issue doesn't affect only lz4, but also all the other compression
> formats that are currently unsopported by KArchive (lzo, lzip, lrzip, ...)

https://invent.kde.org/utilities/ark/-/merge_requests/151 if you want to try it :)
Comment 5 Elvis Angelaccio 2022-11-02 23:02:43 UTC
Git commit 69453c839874d0756add49910d17268a8c7b059c by Elvis Angelaccio.
Committed on 02/11/2022 at 22:59.
Pushed by elvisangelaccio into branch 'master'.

Enable libarchive raw format to support "single-file" archives

libarchive provides a "raw format" that returns a single fake entry
called 'data' and the data for that entry is the whole input archive.

We can use this raw format to handle the "single-file" archives for
which we had the special KArchive-based singlefile plugins.
The advantage is that libarchive supports more formats than KArchive. In
particular with this commit we add support for the following new
formats that KArchive cannot handle:

- application/zlib
- application/x-lz4
- application/x-lzip
- application/x-lrzip
- application/x-lzop

Note 1: This fake 'data' entry requires a bunch of small changes in different
places, for which we use the recently 'displayName' property of
Archive::Entry.

Note 2: the documentation of archive_read_support_format_raw says that
it should not be always enabled, so we only enable it if we have a
"single-file" mimetype. For this purpose we generate in cmake a
LIBARCHIVE_RAW_MIMETYPES define that will be automatically updated when
adding new future mimetypes.
FIXED-IN: 22.12.0

M  +1    -1    kerfuffle/archiveentry.cpp
M  +1    -1    kerfuffle/archiveentry.h
M  +9    -1    kerfuffle/jobs.cpp
M  +1    -1    part/archivemodel.cpp
M  +1    -2    part/arkviewer.cpp
M  +1    -1    part/arkviewer.h
M  +3    -6    part/infopanel.cpp
M  +7    -1    part/part.cpp
M  +18   -0    plugins/libarchive/CMakeLists.txt
M  +79   -29   plugins/libarchive/libarchiveplugin.cpp
M  +3    -1    plugins/libarchive/libarchiveplugin.h

https://invent.kde.org/utilities/ark/commit/69453c839874d0756add49910d17268a8c7b059c