Bug 368851 - Cannot add new files to a specific RAR archive
Summary: Cannot add new files to a specific RAR archive
Status: RESOLVED FIXED
Alias: None
Product: ark
Classification: Applications
Component: plugins (show other bugs)
Version: 16.08.0
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Ragnar Thomsen
URL:
Keywords: investigated, triaged
Depends on:
Blocks:
 
Reported: 2016-09-15 14:07 UTC by Elvis Angelaccio
Modified: 2019-04-07 17:37 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 19.04.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Elvis Angelaccio 2016-09-15 14:07:37 UTC
Process is started but fails with error code 4.

Reproducible: Always
Comment 1 Elvis Angelaccio 2016-09-15 14:52:45 UTC
Seems to happen only with this archive: https://sourceforge.net/projects/kaosx/files/sources/example.rar
Comment 2 Viorel-Cătălin Răpițeanu 2019-02-12 07:31:49 UTC
I've checked the archive provided (it was renewed since 2016), but it looks like it is locked. When I opened it using Ark, he was locked any options that allowed me to add any file to it. 

# unrar v example.rar 

UNRAR 5.70 beta 1 freeware      Copyright (c) 1993-2019 Alexander Roshal

Archive: example.rar
Details: RAR 4, recovery record, lock

 Attributes      Size    Packed Ratio    Date    Time   Checksum  Name
----------- ---------  -------- ----- ---------- -----  --------  ----
    ..A....   5332269   5320706  99%  2012-06-30 10:22  9C91D71F  Fifteen_Feet_of_Time.pdf
----------- ---------  -------- ----- ---------- -----  --------  ----
              5332269   5320706  99%
Comment 3 Viorel-Cătălin Răpițeanu 2019-02-12 08:00:33 UTC
Just to reiterate, I wasn't able to reproduce the original behavior. Right now, Ark doesn't allow you to drop-in any new files.
Comment 4 Elvis Angelaccio 2019-02-16 13:41:21 UTC
(In reply to Viorel-Cătălin Răpițeanu from comment #3)
> Just to reiterate, I wasn't able to reproduce the original behavior. Right
> now, Ark doesn't allow you to drop-in any new files.

That's exactly the bug, it's not possible to add new files to that specific rar archive (using the RAR plugin).
Comment 5 Viorel-Cătălin Răpițeanu 2019-02-16 14:21:38 UTC
(In reply to Elvis Angelaccio from comment #4)
> (In reply to Viorel-Cătălin Răpițeanu from comment #3)
> > Just to reiterate, I wasn't able to reproduce the original behavior. Right
> > now, Ark doesn't allow you to drop-in any new files.
> 
> That's exactly the bug, it's not possible to add new files to that specific
> rar archive (using the RAR plugin).

I may be in the wrong here, but rar archive has the flag 'lock' in it (comment 2). Isn't this an expected behaviour in this scenario?
Comment 6 Elvis Angelaccio 2019-02-16 14:42:48 UTC
(In reply to Viorel-Cătălin Răpițeanu from comment #5)
> (In reply to Elvis Angelaccio from comment #4)
> > (In reply to Viorel-Cătălin Răpițeanu from comment #3)
> > > Just to reiterate, I wasn't able to reproduce the original behavior. Right
> > > now, Ark doesn't allow you to drop-in any new files.
> > 
> > That's exactly the bug, it's not possible to add new files to that specific
> > rar archive (using the RAR plugin).
> 
> I may be in the wrong here, but rar archive has the flag 'lock' in it
> (comment 2). Isn't this an expected behaviour in this scenario?

Probably yes (I don't know what the 'lock' flag in RAR is). But then Ark should make the archive read-only in the UI.
Comment 7 Andrew Crouthamel 2019-03-12 01:49:07 UTC
I don't see an error code in 18.12.3 but it indeed does not add the file, so there should be some sort of UI function to reflect the archive is read-only.
Comment 8 Ragnar Thomsen 2019-04-07 17:37:40 UTC
Git commit 3a21006fa55ca5d382eb8de87b39b7d8ca902e02 by Ragnar Thomsen.
Committed on 07/04/2019 at 17:34.
Pushed by rthomsen into branch 'Applications/19.04'.

Handle locked RAR archives

RAR archives can have a "locked" property essentially making them
readonly. Currently, Ark doesn't handle this properly and fails silently
if the user tries to modify the archive (e.g. adding files).

This diff adds a virtual method ReadOnlyArchiveInterface::isLocked()
with a default implementation returning false. The method is overridden
by the RAR plugin which checks if the archive is locked when listing.
ReadWriteArchiveInterface::isReadOnly() checks isLocked() when
determining the readonly status of the archive.
FIXED-IN: 19.04.0
Differential Revision: D20122

M  +7    -0    autotests/plugins/clirarplugin/clirartest.cpp
A  +-    --    autotests/plugins/clirarplugin/data/locked_archive.rar
M  +9    -0    kerfuffle/archiveinterface.cpp
M  +5    -0    kerfuffle/archiveinterface.h
M  +11   -0    plugins/clirarplugin/cliplugin.cpp
M  +2    -0    plugins/clirarplugin/cliplugin.h

https://commits.kde.org/ark/3a21006fa55ca5d382eb8de87b39b7d8ca902e02