Bug 382606 - when changing a larger file in an archive, Ark asks for confirmation twice
Summary: when changing a larger file in an archive, Ark asks for confirmation twice
Status: RESOLVED FIXED
Alias: None
Product: ark
Classification: Applications
Component: general (show other bugs)
Version: 20.04.0
Platform: Ubuntu Linux
: NOR minor
Target Milestone: ---
Assignee: Elvis Angelaccio
URL:
Keywords: investigated, triaged
: 430512 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-07-22 22:13 UTC by david
Modified: 2021-02-15 22:18 UTC (History)
7 users (show)

See Also:
Latest Commit:
Version Fixed In: 21.04


Attachments
test archive (4 kB of lorem ipsum in a 7z archive) (1.68 KB, application/octet-stream)
2017-08-08 20:50 UTC, david
Details
success and fail (2.31 KB, application/zip)
2018-02-25 22:45 UTC, Edmund Kasprzak
Details
Ark 17.12.3 ran with QT_LOGGING_RULES=ark.*.debug=true (4.59 KB, text/plain)
2018-05-28 09:18 UTC, david
Details
Two prompts from Ark (64.41 KB, image/png)
2019-03-02 23:41 UTC, Barry
Details

Note You need to log in before you can comment on or make changes to this bug.
Description david 2017-07-22 22:13:17 UTC
Steps to reproduce:
1. Open a file in an archive (tested text files in tar, zip and 7z archives, the latter with AES256 encryption).
2. Edit the file and save changes.
3. Ark asks, if the archive should be updated.
4. If yes, Ark asks, if the file should be overwritten (I assume by the copy in /tmp).
5. If the file was larger than ca. 3 kB, steps 3 and 4 repeat.

Expected behavior:
Step 5 (i.e., repetition of steps 3 and 4) shouldn't happen.
(Side note: I also think steps 3 and 4 should be merged.)

I'm running Kubuntu 17.04. (When I was running Kubuntu 16.10 with Ark 16.04, the application [Ark] also crashed after confirming the dialog.)
Comment 1 Elvis Angelaccio 2017-08-08 20:29:17 UTC
Seems to work as expected here. Could you attach an affected test archive?
Comment 2 david 2017-08-08 20:50:24 UTC
Created attachment 107165 [details]
test archive (4 kB of lorem ipsum in a 7z archive)

I've just created this archive as a test and editing the contents (e.g., when I added the heading to the beginning) does trigger confirmation twice. The same happens with formats other than 7z.

Interestingly, I haven't experienced such behavior with a archives recently downloaded from GitHub ("Clone or download" > "Download ZIP").
Comment 3 Elvis Angelaccio 2017-08-08 20:59:29 UTC
Cannot reproduce... 
It could be this got fixed between versions 16.12.3 and 17.08, even though this part of the code did not change much.
Comment 4 Christoph Feck 2017-08-22 10:56:44 UTC
Please ask in a forum of your distribution if you can install ark version 17.08 from backport PPAs to verify.
Comment 5 david 2017-11-06 18:22:26 UTC
Currently running Ark 17.04.3 in Kubuntu 17.10 and the bug still occurs. I've just tested the attached test archive and that worked alright, but Ark basically always asks for confirmation twice, when I edit my personal encrypted archive (~8kB; 7z w/ AES256).
Comment 6 Edmund Kasprzak 2018-02-25 21:24:03 UTC
I can confirm it but it's a very tricky.

In Kubuntu 17.10 (Plasma 5.10.5, Ark 17.04.3) I can recreate it almost every time.
But the issue shows itself only from a second attempt. So, first time txt file is edited, everything's fine.
When I try to do it second time (without closing Ark) then it appears almost every time.

I was also able to achieve it in Neon Git Stable (Plasma 5.12.2, KF 5.43.0, Qt 5.10.0, Ark 17.12.2) but it happens randomly (2 "wins" in 15+ tries)

I think never in a first attempt (of txt editing), rarely in a second attempt.

Any ideas/advice what kind of information (and how) can I try to catch when able to make this issue occur?
Comment 7 Edmund Kasprzak 2018-02-25 22:45:19 UTC
Created attachment 110999 [details]
success and fail

Ark run as "QT_LOGGING_RULES=ark.*.debug=true ark"

Success and fail (double confirmation) scenario konsole log.

Not sure if it's gonna be helpful, but clearly visible that ark notices need of re-upload ("ark.part: Watched file modified: "/tmp/ark-qNaWWO/lorem-ipsum.txt"") 2 times - line 13 and 14 in fail.txt

It happens after saving a modified file.

What's weird - sometimes it happens (2 lines "ark.part: Watched file modified" appear) as in fail.txt
And sometimes - just one line appears as in success.txt.

Everything happens with the same test.7z archive attached in this ticket.

Tested in Neon Git Stable, Plasma 5.12.2, KF 5.43.0, Qt 5.10.0
Comment 8 david 2018-05-28 09:18:46 UTC
Created attachment 112918 [details]
Ark 17.12.3 ran with QT_LOGGING_RULES=ark.*.debug=true

Reproduced again with Ark 17.12.3. The attachment contains output similar to Edmund's.

environment: Kubuntu 18.04, KDE Plasma 5.12.5, KDE Frameworks 5.44.0, Qt 5.9.5
Comment 9 Barry 2019-03-02 23:40:11 UTC
The behaviour described in the first comment is indeed what you see. On my system (Fedora 29, Plasma 5.14.5, Ark 18.4.3) I created a text file, archived it as a .tar.gz with Ark, then used "Open with..." in Ark to edit it in Kate, Increased the file size by duplicating the text and then saved it. Ark asked twice to confirm overwrite of the file in the archive. See attached screen shot.
Comment 10 Barry 2019-03-02 23:41:49 UTC
Created attachment 118492 [details]
Two prompts from Ark

Clicking the "Yes" button results in a path update confirmation dialog, which happens for each of these Yes/No boxes.
Comment 11 Barry 2019-03-02 23:46:25 UTC
Just to add, I'm a newbie with Bugsquad. Details of test system:
Ark version 18.4.3
Plasma version 15.4.5
KDE Frameworks version 5.55.0
Qt version 5.11.3
Comment 12 david 2019-10-04 13:32:40 UTC
I have recently upgraded to Kubuntu 19.10 Beta (KDE Apps 19.04.3), and the issue is still present.
Comment 13 Julius R. 2020-04-30 10:38:43 UTC
I experience the same bug. Everytime a file is modified and written back to the archive, ark asks twice for confirmation.

Running Manjaro with KDE Plasma 5.18.4
Comment 14 Elvis Angelaccio 2020-12-28 20:33:05 UTC
*** Bug 430512 has been marked as a duplicate of this bug. ***
Comment 15 Bug Janitor Service 2021-02-04 14:41:27 UTC
A possibly relevant merge request was started @ https://invent.kde.org/utilities/ark/-/merge_requests/25
Comment 16 Elvis Angelaccio 2021-02-15 22:18:01 UTC
Git commit 9074c10373681de1567fef0ee35a690d8514b4b5 by Elvis Angelaccio, on behalf of Jan Paul Batrina.
Committed on 15/02/2021 at 22:17.
Pushed by elvisangelaccio into branch 'master'.

Display confirmation dialog only once when files in archive are modified

Since QFileSystemWatcher::fileChanged is emitted everytime flush()
is called on a file, slotWatchedFileModified gets called multiple times,
especially for large files. (see https://bugreports.qt.io/browse/QTBUG-8244)

If no new fileChanged signal is emitted 200ms after the last one,
we interpret that as "the file has been fully written"

200ms was arbitrarily chosen to be a balance between a long enough flush interval
and "instant" feedback to the user, but it can be fine tuned later.

M  +28   -1    part/part.cpp
M  +5    -0    part/part.h

https://invent.kde.org/utilities/ark/commit/9074c10373681de1567fef0ee35a690d8514b4b5