[utilities/krusader] krArc: Give time to external unpackers to uncompress very big files. Show more error messages

Toni Asensi Esteve null at kde.org
Sat May 1 19:17:43 BST 2021


Git commit 48b385d255e00a75f406fb10d650cd03aeccae95 by Toni Asensi Esteve.
Committed on 01/05/2021 at 18:17.
Pushed by asensi into branch 'master'.

Give time to external unpackers to uncompress very big files. Show more error messages

Notes:
1) A method in order to {check if the process is running} was used like the
one in <https://doc.qt.io/qt-5/qprocess.html>:
    if (!builder.waitForFinished())
        qDebug() << "Make failed:" << builder.errorString();
    else
        qDebug() << "Make output:" << builder.readAll();
2) An
    error(KIO::ERR_SLAVE_DEFINED, i18n("After [...]
line was utilized, which is analogous to the
    error(KIO::ERR_SLAVE_DEFINED, i18n("Copying to mtp slaves is still under development!"));
line in
    https://github.com/KDE/kio-stash/blob/master/src/ioslave/ioslave.cpp
3) A `proc.waitForFinished(-1);` line was used, like two similar ones
in kmountman.cpp.

GUI: A new error message can be seen by the user.

FIXED: [ 433294 ] Gibberish error when extracting large file from zip archive
BUG: 433294

Revision: https://invent.kde.org/utilities/krusader/-/merge_requests/44

M  +6    -1    krArc/krarc.cpp

https://invent.kde.org/utilities/krusader/commit/48b385d255e00a75f406fb10d650cd03aeccae95

diff --git a/krArc/krarc.cpp b/krArc/krarc.cpp
index 3c08d94b..d846e735 100644
--- a/krArc/krarc.cpp
+++ b/krArc/krarc.cpp
@@ -504,7 +504,12 @@ void kio_krarcProtocol::get(const QUrl &url, int tries)
     proc.start();
     RESET_KRCODEC
 
-    proc.waitForFinished();
+    // Wait until the external unpacker has finished
+    if (!proc.waitForFinished(-1)) {
+        error(KIO::ERR_SLAVE_DEFINED, i18n("An error has happened, related to the external program '%1'. "
+                                           "The error message is: '%2'.", cmd, proc.errorString()));
+        return;
+    }
 
     if (!extArcReady && !decompressToFile) {
         if (proc.exitStatus() != QProcess::NormalExit || !checkStatus(proc.exitCode()) || (arcType != "bzip2" && arcType != "lzma" && arcType != "xz" && expectedSize != decompressedLen)) {


More information about the kde-doc-english mailing list