Bug 382599

Summary: Progress bar does not work correctly during files extraction
Product: [Applications] ark Reporter: Patrick Silva <bugseforuns>
Component: pluginsAssignee: Ragnar Thomsen <rthomsen6>
Status: REOPENED ---    
Severity: normal CC: andrew.crouthamel, edkasp, elvis.angelaccio, minas1618033, tata668
Priority: NOR    
Version: 22.08.1   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=470654
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Patrick Silva 2017-07-22 16:28:38 UTC
Notifications tray icon shows a progress bar when I extract rar files, but it does not work correctly.
Progress bar indicates half progress immediatly after ark starts the extraction and its status does not change until the extraction is finished.

Ark 17.04.3 on Arch
Comment 1 Elvis Angelaccio 2017-07-22 17:17:28 UTC
Which plugin are you using? unrar or unarchiver?
Comment 2 Patrick Silva 2017-07-22 17:36:19 UTC
unrar
Comment 3 Edmund Kasprzak 2018-02-18 18:33:20 UTC
I can confirm this behavior in current Neon git stable (Plasma 5.12.1, KF 5.43.0, Qt 5.9.3, Ark 17.12.2).

Archives created also using Ark in the same system using RAR4 or RAR5 option.

When extraction starts progres bar starts with 50% already, then sometimes it goes to ~75% and stays on it for a few seconds then quits.
And sometimes it starts, lasts and quits, everything on 50%.

When using unarchiver, progress bar is just a ping-pong going from left to right and vice versa.
Comment 4 Patrick Silva 2018-03-11 15:55:14 UTC
(In reply to Dr. Chapatin from comment #0)

> Progress bar indicates half progress immediatly after ark starts the
> extraction and its status does not change until the extraction is finished.

Same when I extract tar file.

Wuen I extract 7zip or zip file notification applet shows "ping-pong progress bar". Progress bar is completely broken.
Comment 5 Ragnar Thomsen 2019-03-27 19:16:54 UTC
Git commit ce2f7f6690be1e5165ec1300affeabd5cc146e31 by Ragnar Thomsen.
Committed on 27/03/2019 at 19:12.
Pushed by rthomsen into branch 'Applications/19.04'.

Fix progress info for CreateJob

Progress info is currently broken when creating archives using
CreateJob. This happens e.g. when the user creates an archive
through the KFileItemAction in Dolphin.
This is caused by CreateJob using a nested AddJob and the percent
signal of the AddJob was not forwarded to CreateJob.

It was encessary to use QOverload since KJob has both a signal and a
member function called percent.
FIXED-IN: 19.04.0
Differential Revision: D19953

M  +3    -0    kerfuffle/jobs.cpp

https://commits.kde.org/ark/ce2f7f6690be1e5165ec1300affeabd5cc146e31
Comment 6 Ragnar Thomsen 2019-03-30 09:56:13 UTC
I accidentally closed the wrong bug in commit ce2f7f6690be1e5165ec1300affeabd5cc146e31. Reopening.
Comment 7 Ragnar Thomsen 2019-03-30 10:01:05 UTC
I cannot reproduce this with Ark 19.04 and unrar version 5.73. How exactly did you extract the archive?
Comment 8 Patrick Silva 2019-03-30 14:18:06 UTC
I tested RAR, ZIP and 7zip files using the three methods available in the context menu of Dolphin: "Extract archive here", "Extract archive to..." and "Extract archive here, autodetect subfolder".

RAR:
progress bar works as expected with single files.
However, with divided files, the progress bar indicates half progress immediatly after ark starts the extraction and its status does not change until the extraction is finished.

ZIP:
I only see "ping-pong" progress bar when I extract single and divided files.

7zip:
Same as ZIP files.
Comment 9 Patrick Silva 2019-03-30 14:18:46 UTC
I use Ark 18.12.3.

Operating System: Arch Linux 
KDE Plasma Version: 5.15.3
KDE Frameworks Version: 5.56.0
Qt Version: 5.12.2
Comment 10 Patrick Silva 2019-03-30 14:23:27 UTC
Well, in fact the progress bar does work as expected even with single RAR files.
It immediately starts at 50%, but it does not remains frozen until the extraction is finished.
Comment 11 Patrick Silva 2019-03-30 15:01:09 UTC
Tested a 2.5 GiB tar.gz file: plasma shows "Extracting files: finished" notification
when the progress bar reaches approximately 40%.
Comment 12 Patrick Silva 2019-03-30 19:32:42 UTC
I tested with Ark 19.04 beta the extraction of a folder containing 126 jpg files (~300 MiB) compressed to several formats, "Extract archive here" option from Dolphin was used. My results:

tar.z - progress bar jumps to ~30% immediately when the extraction starts
tar.lz4 - progress bar jumps to ~60% immediately when the extraction starts
tar - progress bar jumps to ~70% immediately when the extraction starts
tar.zst - progress bar jumps to ~40% immediately when the extraction starts
tar.gz - progress bar jumps to ~40% immediately when the extraction starts
tar.xz - progress bar jumps to ~5% immediately when the extraction starts

The progress bar works as expected when I extract the same folder/files compressed
to the following formats:
tar.bz2
tar.lz
tar.lzma
Comment 13 Patrick Silva 2019-03-30 20:15:21 UTC
"ping-pong" progress bar also occurs while Ark extracts .jar file.
Comment 14 Ragnar Thomsen 2019-03-31 09:23:33 UTC
Thanks for the testing. Here is some background.

When extracting using the context-menu of dolphin, the archive is listed first to get different archive properties. The progress is then divided in two phases: List and extract. In some cases the first phase is very fast, e.g. for archives with few entries and the progress bar seems to jump to 50% instantly. In other cases it can take some time. So this is the currently intended behavior.

Regarding the cli7z plugin, it currently doesn't support percentage progress. This is why the "ping-pong" progress is shown. This is due to the 7z executable using some trick to output the percentage progress by overriding the current line on the terminal and we are therefore unable to capture the progress output with QProcess. To fix this we would have to find some other way to calculate the progress. The libzip plugin which also can handle zip archives has working percentage progress.
Comment 15 Patrick Silva 2019-09-10 19:10:17 UTC
The progress bar does not work when I extract zip and jar via the context menu of Dolphin.
However the progress bar works as expected if I open zip and jar archives with Ark then extract them via "Extract" button.

The progress bar never works while Ark extracts a 7zip archive.

Operating System: Arch Linux 
KDE Plasma Version: 5.16.5
KDE Frameworks Version: 5.61.0
Qt Version: 5.13.1
Comment 16 Patrick Silva 2019-09-10 19:57:25 UTC
When I extract a RAR file via the context menu of Dolphin, the progress bar immediately jumps to ~40% when Plasma shows the progress notification. Such behavior does not occur if I open the RAR file with Ark and extract it via "Extract" button.

The progress bar does not work when Ark extracts a zip file divided in several parts (file.zip.001, file.zip.002, etc) even if I open its first part with Ark then use "Extract" button.
Comment 17 Ragnar Thomsen 2020-04-12 14:06:04 UTC
Git commit ec320540e6e3e2d69d19a517e67073168a054df5 by Ragnar Thomsen.
Committed on 12/04/2020 at 13:56.
Pushed by rthomsen into branch 'release/20.04'.

libzip: Enable progress when batch-extracting

Reimplement hasBatchExtractionProgress() in LibzipPlugin so progress
works when batch-extracting.

Partially resolves bug 382599.
Differential Revision: D28722

M  +6    -0    plugins/libzipplugin/libzipplugin.cpp
M  +1    -0    plugins/libzipplugin/libzipplugin.h

https://commits.kde.org/ark/ec320540e6e3e2d69d19a517e67073168a054df5
Comment 18 Patrick Silva 2020-11-09 11:31:19 UTC
*** Bug 428870 has been marked as a duplicate of this bug. ***
Comment 19 2wxsy58236r3 2022-10-05 09:07:45 UTC
*** Bug 459393 has been marked as a duplicate of this bug. ***
Comment 20 2wxsy58236r3 2022-10-05 09:07:48 UTC
*** Bug 459394 has been marked as a duplicate of this bug. ***
Comment 21 2wxsy58236r3 2022-10-05 09:28:16 UTC
@Patrick Silva

If you "disable libzip plugin or disable both libzip and info-zip plugins", Ark will have to use the cli7z plugin. (Bug 459394)
Ark uses the cli7z plugin to extract 7z files. (Bug 459393)

Therefore, please refer to Comment 14 above:

> Regarding the cli7z plugin, it currently doesn't support percentage
> progress. This is why the "ping-pong" progress is shown. This is due to the
> 7z executable using some trick to output the percentage progress by
> overriding the current line on the terminal and we are therefore unable to
> capture the progress output with QProcess. To fix this we would have to find
> some other way to calculate the progress. The libzip plugin which also can
> handle zip archives has working percentage progress.
Comment 22 Patrick Silva 2022-10-05 11:16:45 UTC
(In reply to 2wxsy58236r3 from comment #21)
> @Patrick Silva
> 
> If you "disable libzip plugin or disable both libzip and info-zip plugins",
> Ark will have to use the cli7z plugin. (Bug 459394)
> Ark uses the cli7z plugin to extract 7z files. (Bug 459393)
> 
> Therefore, please refer to Comment 14 above:
> 
> > Regarding the cli7z plugin, it currently doesn't support percentage
> > progress. This is why the "ping-pong" progress is shown. This is due to the
> > 7z executable using some trick to output the percentage progress by
> > overriding the current line on the terminal and we are therefore unable to
> > capture the progress output with QProcess. To fix this we would have to find
> > some other way to calculate the progress. The libzip plugin which also can
> > handle zip archives has working percentage progress.

Thanks for clarifying. :)
Comment 23 2wxsy58236r3 2022-10-06 04:20:27 UTC
Now that Igor Pavlov maintains the Linux version of 7-Zip, maybe Ark developers can ask him to modify 7z executable's output behavior on 7-Zip's SourceForge project page? [1]

[1] https://sourceforge.net/p/sevenzip/discussion/