Summary: | libzipplugin: CRC checksums of files not shown when the first entry in ZIP is a directory | ||
---|---|---|---|
Product: | [Applications] ark | Reporter: | Higa <c822c4f23bca1ea6faac79e2> |
Component: | plugins | Assignee: | Ragnar Thomsen <rthomsen6> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | bugseforuns, elvis.angelaccio |
Priority: | NOR | ||
Version: | 18.12.3 | ||
Target Milestone: | --- | ||
Platform: | Compiled Sources | ||
OS: | Linux | ||
Latest Commit: | https://commits.kde.org/ark/3ad7526bf9ce4348a4ed3c6d1f30d32daf5bb529 | Version Fixed In: | 19.04.2 |
Sentry Crash Report: | |||
Attachments: | Files for reproducing the bug |
Thanks for the report. Do you feel like submitting a patch? :) 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 |
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.