Bug 474672 - Compressing multiple files from different directories may produce a corrupted archive
Summary: Compressing multiple files from different directories may produce a corrupted...
Status: REPORTED
Alias: None
Product: dolphin
Classification: Applications
Component: general (show other bugs)
Version: 23.08.1
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Dolphin Bug Assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-09-18 23:00 UTC by Vova Mshanetskiy
Modified: 2023-10-06 12:49 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vova Mshanetskiy 2023-09-18 23:00:00 UTC
SUMMARY
If you switch Dolphin into details view mode, expand one or multiple sub-directories of your current directory, select multiple files from different directories and compress them using the right-click menu, then the resulting archive may be corrupted.

STEPS TO REPRODUCE
1. Create a directory structure as if by the following shell commands:
    mkdir -p ~/bug/foo
    touch ~/bug/foo/bar.txt ~/bug/baz.txt
2. Open ~/bug in Dolphin, switch to details view mode and expand directory foo
3. Select files foo/bar.txt and baz.txt (e.g. by control-clicking). Directory foo should remain not selected.
4. Right-click one of selected files and select Compress -> Here as "Archive.zip" (compressing as tar.gz results in the same bug)

OBSERVED RESULT
The created archive is corrupted. If you open it in Dolphin, it shows that the archive contains only bar.txt. If you open it in Ark, it shows an error message saying that the archive "contains ill-formed entries and might be a malicious archive". If you run unzip -l on it, it outputs:

Archive:  foo/Archive.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
        0  2023-09-19 01:21   bar.txt
        0  2023-09-19 01:21   ../baz.txt
---------                     -------
        0                     2 files

EXPECTED RESULT
I would expect the archive to contain bar.txt and baz.txt without any directory entries. So, in general i would expect Dolphin to place all selected files or directories into the root of the archive. But, i guess, someone might expect Dolphin to recreate parent directories of all selected files or directories inside the archive up to current directory or the closest common parent directory (i.e. in this case the archive would contain foo/bar.txt and baz.txt).

SOFTWARE/OS VERSIONS
Linux: KDE neon 5.27 (neon-user-20230914-1959.iso, live session)
KDE Plasma Version: 5.27.8
KDE Frameworks Version: 5.110.0
Qt Version: 5.15.10

ADDITIONAL INFORMATION
I have just checked what GNOME Files does (in Ubuntu 22.04 live ISO i had laying around), and it seems to do the first option i have described above.