https://bugs.kde.org/show_bug.cgi?id=526824

            Bug ID: 526824
           Summary: [Potential data loss] Failed RAR extraction can move
                    unrelated files from the filesystem root into the
                    extraction directory
    Classification: Applications
           Product: ark
      Version First 25.04.3
       Reported In:
          Platform: Debian stable
                OS: Linux
            Status: REPORTED
          Severity: critical
          Priority: NOR
         Component: general
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
  Target Milestone: ---

Created attachment 196960
  --> https://bugs.kde.org/attachment.cgi?id=196960&action=edit
Full journal

FOREWORD

I encountered this error when I was trying to unpack some old RAR archives. I’m
not a novice when it comes to using Linux and can certainly manage on my own.
However, since this affected my server’s backup disk, I asked the LLM to help
me, because I wanted to keep the backup as intact as possible.

I asked LLM to write the following summary. I proofread it and, to the best of
my knowledge and belief, removed or rewrote duplicate paragraphs and phrases
typical of LLM’s style.

STEPS TO REPRODUCE

The issue occurred while using Dolphin/Ark on an external NTFS filesystem
mounted using the Linux ntfs3 driver. I strongly recommend reproducing this
only on a disposable test filesystem. In my case the failure unexpectedly moved
approximately 500 GB of unrelated data.

- Have 7zip installed, but not the Debian 7zip-rar package.
- Use a RAR archive which can be listed by 7-Zip but whose compression method
cannot be decoded by the Debian build of 7-Zip.
- In Dolphin, use the Ark context-menu action “Extract here and delete
archive”.
- The extraction fails.

OBSERVED RESULT

Instead of only aborting the archive extraction, Ark/Dolphin created a
directory named after the mounted filesystem inside the extraction directory:

/media/robert/RBackup/Sicherungsdaten/home/Dokumente/Projekte/H-Nissan/Nissan
FAST/2001.10/RBackup/

This directory unexpectedly contained data originating from the ROOT of the
mounted filesystem, including for example:

Familiendaten/
.Trash-1000/
8130004-v045-linux-test/
$RECYCLE.BIN/
.sync.ffs_db

Approximately 500 GB of data had been moved from the root of the NTFS
filesystem into this newly-created directory.

The original directory hierarchy at the filesystem root was partly left behind
as empty directory skeletons, while the regular files themselves had been moved
into the unexpected RBackup/ directory.

For example, before recovery:
/media/robert/RBackup/Familiendaten ~1.2 GB

while:
.../2001.10/RBackup/Familiendaten ~487 GB

The affected source contained 25,426 files, while only 113 files remained in
the original Familiendaten tree.

I verified file-by-file before recovery that there were no pathname collisions
between these two Familiendaten trees. The same happened to the filesystem’s
.Trash-1000 directory and another top-level directory.

I was able to recover the data because the unexpected operation appears to have
been a move/rename within the same filesystem rather than file-content
destruction. No file-content loss has been proven in this incident.

However, this behavior has severe data-loss potential. A failed archive
extraction must never move unrelated existing data from the filesystem root.
Depending on filename collisions, subsequent cleanup, user actions, or another
interruption, this could plausibly result in permanent data loss.

IMPORTANT JOURNAL EVIDENCE

At 20:18:29, while the extraction was still running, Ark/Kerfuffle was already
accessing paths inside the unexpected directory:

ark.kerfuffle: File
".../2001.10/RBackup/8130004-v045-linux-test/USR/SEA.INSTALL/TMP/.dir" exists.
ark.kerfuffle: File ".../2001.10/RBackup/Familiendaten/.Trash-0/files" exists.
This message occurred multiple times.

Immediately afterwards:
ark.kerfuffle: Extraction aborted, destination folder might not have enough
space.

Then Ark reported:
ark.kerfuffle: Failed to restore old working directory:
".../2001.10/.dolphin-.wraHeF"

ark.kerfuffle: Failed to restore old working directory:
".../2001.10/.dolphin-.IXceQp"

Shortly afterwards several Dolphin/KIO workers reported:
kf.kio.core.connection: Socket not connected QLocalSocket::PeerClosedError
kf.kio.core: An error occurred during write. The worker terminates now.
There are no corresponding kernel NTFS, /dev/sda, I/O, ENOSPC, or kernel OOM
errors in the same time window.

There were no coredumps.

ARCHIVE / BACKEND DETAILS

The archive itself can be listed normally:
$ 7z l Disk1.rar
Type = Rar
Characteristics = Recovery
Multivolume = -
Volumes = 1

The archive contains only paths beginning with Disk1/....

It DOES NOT contain paths such as:
RBackup/...
Familiendaten/...
.Trash-1000/...

Therefore the unexpected RBackup/... hierarchy does not originate from
filenames stored in the archive.

Testing the archive directly with the Debian 7-Zip build:
$ 7z t Disk1.rar
ERROR: Unsupported Method
...
...
Sub items Errors: 690
Archives with Errors: 1

So the initial extraction failure itself is understandable: the installed
Debian 7-Zip build does not support the compression method used by this RAR.

The dangerous bug is what Ark/Kerfuffle/KIO does after or during that
extraction failure.

SOFTWARE / OS
Dolphin: 25.04.3
Ark: 25.04.3
KDE Frameworks / KIO: 6.13.0
Qt: 6.8.2
7-Zip: 25.01+dfsg-1~deb13u2
7zip-rar: not installed

Filesystem: NTFS using the Linux ntfs3 driver source and unexpected destination
were on the same mounted filesystem

Mount point: /media/robert/RBackup

Additional system/kernel information is attached separately.

TEST ARCHIVES
Disk1.rar: SHA-256:
b5028d66f63cb8dbf348d64ca7c3d7a7533332e02e6ebfe67a6d3573ec34727d
Disk2.rar: SHA-256:
a02fba932980f4672085648726b9d4cafd4f00d8c477ee68b7e4efdd1dcbf294

I am keeping the original archives unchanged.

Because the archives contain third-party software/data, I have not attached
them publicly. I may be able to provide a reproducer or the archive privately
if needed and legally permissible.

POSSIBLY RELATED KDE BUGS

Bug 438510: “Dolphin shows incorrect not enough space messages”

This appears related to the misleading “destination folder might not have
enough space” message, but does not describe the destructive/unexpected
recursive move seen here.

Bug 510810: KIO/Dolphin move/rename failures, including reports involving a
kernel ntfs3 mount and “Extract here and delete archive”.

However, that bug was reported against KIO 6.19 and fixed in 6.20. My system
uses KIO 6.13.0, so this does not appear to be the same regression.

Bug 208384 is also potentially relevant as historical Ark implementation
context: Ark’s CLI extraction handling has used temporary extraction
directories followed by moving files to their final destination.

ATTACHMENTS AVAILABLE

Full journal from 20:10 through 20:23, without grep/filtering [Attached]

Kernel journal for the same period
Filtered Ark/Dolphin/KIO log
Exact package and system environment
findmnt / lsblk filesystem information
complete output of 7z t Disk1.rar
SHA-256 hashes of the original RAR files

No relevant ntfs3/kernel I/O errors were logged during the incident.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to