Commit graph

40 commits

Author SHA1 Message Date
Ivailo Monev
21f81958f2 kutils: remove karchive TODO
archive_match_include_pattern() does not work on archive open for reading

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-05-23 18:33:20 +03:00
Ivailo Monev
e4c8f00e14 kutils: plug KArchive memory leaks
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-05-21 07:00:06 +03:00
Ivailo Monev
f852199986 kutils: KArchive remove and extraction operations optimizations
a bit hach-ish but reduced the time it takes to extract archives with a lot
of small files for example

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-05-20 07:48:16 +03:00
Ivailo Monev
631ae6a32a kutils: remove unused constants
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-05-19 06:20:35 +03:00
Ivailo Monev
55432743c0 kutils: assume that KArchive::list() filtered the entries when recursing
the conditionals were there to maybe match with and without trailing slash
but KArchive::list() works correctly for the fomats that do not add
trailing slash to directories aswell

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-12-25 23:33:12 +02:00
Ivailo Monev
1f60123bd7 kutils: check if the entry is directory as fallback when recursing in KArchive::remove() and KArchive::extract()
for some formats (such as ISO 9660 images) the directories do not end with
trailing slash

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-12-25 06:44:59 +02:00
Ivailo Monev
efa445c361 kutils: mark some KArchivePrivate methods as const
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-12-24 13:15:45 +02:00
Ivailo Monev
0bc98740e0 kutils: error string correction
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-12-24 13:13:14 +02:00
Ivailo Monev
4c16e7c0d5 kutils: recursively remove/extract when paths contain directory
this also makes it match the behaviour of KArchive::add() which recurses
into directories and adds the files that the specified directory holds

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-12-24 01:56:21 +02:00
Ivailo Monev
81ac307c68 kutils: move some KArchive MIME types from the writable to the readable list
side note: `bsdtar` creates archives with the MIME type extension as
application/x-tar even if the extension is not recognized by libarchive
(i.e. autodetection fails but it proccedes anyway)

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-12-22 01:57:19 +02:00
Ivailo Monev
45110ac273 kutils: remove the temporary archive if error occurs in KArchive::add() and KArchive::remove()
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-12-20 10:56:10 +02:00
Ivailo Monev
3298200d40 kutils: new getter and setter for the temporary KArchive prefix
to be used by ark

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-12-19 18:01:51 +02:00
Ivailo Monev
3f692a32f9 kutils: implement progress signal for KArchive
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-10-27 03:47:53 +03:00
Ivailo Monev
efd9978abf kutils: libarchive does not support plain bzip, gzip and xz formats
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-10-17 13:46:41 +03:00
Ivailo Monev
78f4dd9aee kutils: do not include the libarchive function name in error strings
for consistency since some errors strings are not based on libarchive
error codes

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-10-15 20:06:36 +03:00
Ivailo Monev
591e73ca63 kutils: update readable and writable KArchive MIME types
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-10-15 19:47:08 +03:00
Ivailo Monev
04fa9c4bf9 Merge branch 'master' of https://scm.osdn.net/gitroot/kde/kdelibs 2022-10-15 19:38:39 +03:00
Ivailo Monev
37c782601f kutils: mark KArchive and KSpeech as stable
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-10-15 19:45:37 +03:00
Ivailo Monev
3f28263411 kutils: when opening archive fails in helper methods return null
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-10-15 19:36:59 +03:00
Ivailo Monev
1dfb02b361 kutils: slightly better writable archive check
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-10-11 07:38:27 +03:00
Ivailo Monev
8d2453c1be kutils: manually set the archive filter when it is known to not be recognized by libarchive
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-10-11 07:31:53 +03:00
Ivailo Monev
c37e70c894 kutils: set the group and username of new archive entries
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-10-10 01:49:25 +03:00
Ivailo Monev
2c7288649c kutils: stub KArchive progress signal
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-10-09 21:02:31 +03:00
Ivailo Monev
8caebd2d4f Revert "kutils: fix archive entry double-free in case of archive_write_header() failure"
This reverts commit faefab7258.
2022-10-09 16:00:17 +03:00
Ivailo Monev
e82f83a22a kutils: implement methods for checking if archive requires passphrase and set one for reading and writing
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-10-09 15:36:08 +03:00
Ivailo Monev
faefab7258 kutils: fix archive entry double-free in case of archive_write_header() failure
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-10-09 15:26:27 +03:00
Ivailo Monev
578396197e kutils: correct archive_read_extract2() failure error reporting
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-10-09 15:03:06 +03:00
Ivailo Monev
02229df53a kutils: read the next header before skipping if path does not match in KArchive::list()
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-10-09 05:38:52 +03:00
Ivailo Monev
4ff227e336 kdecore: emulate cross-filesystem move in KDE::rename()
if the temporary directory is of tmpfs type (which is the case on
Debian) then moving temporary files will fail thus thumbnails will not be
cached for example because they are stored as temporary file first and
then moved to ~/.thumbnails

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-10-07 22:38:57 +03:00
Ivailo Monev
0e3275dc35 kutils: make use of the new KTemporaryFile::filePath() method
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-10-07 05:22:41 +03:00
Ivailo Monev
9afece26a8 kutils: implement operator equal for KArchiveEntry
required to check if QList<KArchiveEntry> contains KArchiveEntry for example

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-10-06 21:31:25 +03:00
Ivailo Monev
720e62b6f1 kutils: check if the leading directory is writable from KArchive constructor
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-10-06 19:58:29 +03:00
Ivailo Monev
95162630d4 kutils: process events while iterating over the paths that need to be added in KArchive::add()
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-10-06 22:28:16 +03:00
Ivailo Monev
6d66041086 kutils: zero-initialize the readlink() buffer in KArchive::add()
fixes adding to archive in case of symlink

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-10-06 22:22:52 +03:00
Ivailo Monev
16ebe8408f kutils: copy-pasta typo
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-10-06 22:21:40 +03:00
Ivailo Monev
14f75001ba kutils: set the passphase callback to dummy one for now
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-10-06 21:09:54 +03:00
Ivailo Monev
2a0f817096 kutils: build fix for the case when strmode() is available
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-10-06 21:07:26 +03:00
Ivailo Monev
587259b61f kutils: save errno value before calling functions that may change it in KArchive::add()
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-10-06 20:31:54 +03:00
Ivailo Monev
2170542166 kutils: define PATH_MAX to _POSIX_PATH_MAX if it is not defined
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-10-06 20:30:50 +03:00
Ivailo Monev
3ab3f3b47f kutils: new karchive library to replace KZip and KTar
it has to solve a few problems like:
1. blocking the current thread while listing, extracting or adding to
   archive
2. lack of support for some archive formats such as 7-zip in the
   previously available classes for dealing with archive
3. progress and error reporting

a KArchiveJob class may have to be implemented to solve the above
issues. the API is just as frustrating to use as KTar and KZip right now
tho and I am not happy with that but the class itself is a 3-rd rewrite
of what was once Python module, plugin for another project and now used
as base in library.

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-10-06 16:53:55 +03:00