Bug 406135 - libzipplugin: CRC checksums of files not shown when the first entry in ZIP is a directory
Summary: libzipplugin: CRC checksums of files not shown when the first entry in ZIP is...
Status: RESOLVED FIXED
Alias: None
Product: ark
Classification: Applications
Component: plugins (show other bugs)
Version: 18.12.3
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Ragnar Thomsen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-04-02 06:08 UTC by Higa
Modified: 2019-05-12 11:10 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 19.04.2


Attachments
Files for reproducing the bug (10.00 KB, application/x-tar)
2019-04-02 06:08 UTC, Higa
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Higa 2019-04-02 06:08:26 UTC
Created attachment 119207 [details]
Files for reproducing the bug

SUMMARY
When a ZIP file contains directory(ies) and file(s), and the first entry in a ZIP file is a directory, Ark will not show the CRC checksums of the file(s).

STEPS TO REPRODUCE
1. Create a directory and some files, and place some files into the directory.
2. Check the first entry of the ZIP file and see if it is a directory by running `ziptool test_3.zip stat 0`.
3. Open the ZIP file using Ark.

A tar file containing 3 ZIP files has been attached. test_3.zip can be used to reproduce the bug.
test_1.zip is created by `zip -r test_1.zip a 1.txt`.
test_2.zip is created by `zip --no-dir-entries -r test_2.zip a b`.
test_3.zip is created by `zip -r test_3.zip a b random_text.txt`.

OBSERVED RESULT
For test_1.zip, since the first entry is `1.txt`, the CRC checksums of all files are displayed correctly.
For test_2.zip, all files are stored inside the directories, but since `--no-dir-entries` is used (not creating entries for directories), the CRC checksums of all files are displayed correctly.
For test_3.zip, the first entry is `a/` (directory), and the CRC checksums of `2.txt`, `3.txt` and `random_text.txt` are not shown.

EXPECTED RESULT
For test_3.zip, Ark should show the CRC checksums of `2.txt`, `3.txt` and `random_text.txt`.

ADDITIONAL INFORMATION
If I change lines 305 to 307 of `plugins/libzipplugin/libzipplugin.cpp` and remove the condition `if (!e->isDir())`, then the problem can be partially fixed - Ark will show CRC "0" for directories and CRC checksums for the files (such as "DB410B7F" for `a/2.txt`) when opening test_3.zip.

When opening RAR files, there is no similar bug, and Ark will show CRC "00000000" for directories.
Comment 1 Elvis Angelaccio 2019-04-06 16:36:38 UTC
Thanks for the report. Do you feel like submitting a patch? :)
Comment 2 Ragnar Thomsen 2019-05-12 11:10:06 UTC
Git commit 3ad7526bf9ce4348a4ed3c6d1f30d32daf5bb529 by Ragnar Thomsen.
Committed on 12/05/2019 at 11:09.
Pushed by rthomsen into branch 'Applications/19.04'.

Get columns to show from first file entry

Currently, we use the first entry in an archive to determine which
columns to show. If the first entry happens to be a directory, then all
relevant columns might not be shown.

Make sure we always check the first file entry for columns to
show.
FIXED-IN: 19.04.2
Differential Revision: D20683

M  +12   -5    part/archivemodel.cpp
M  +4    -0    part/archivemodel.h

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