Bug 394542 - [libzip] Selecting folder and choosing Extract should also extract folder contents
Summary: [libzip] Selecting folder and choosing Extract should also extract folder con...
Status: RESOLVED FIXED
Alias: None
Product: ark
Classification: Applications
Component: general (show other bugs)
Version: 18.04.1
Platform: Other Linux
: NOR wishlist
Target Milestone: ---
Assignee: Elvis Angelaccio
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-05-21 22:10 UTC by Øystein Steffensen-Alværvik
Modified: 2018-06-17 14:01 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 18.04.3


Attachments
Problematic zip (2.23 MB, application/zip)
2018-06-16 16:51 UTC, Øystein Steffensen-Alværvik
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Øystein Steffensen-Alværvik 2018-05-21 22:10:10 UTC
What I do:
– I open an archive with Ark that contains multiple folders and files in these folders
– I select a folder (without expanding the view) and choose Extract.
– I choose a folder and hit Extract

What *currently* happens:
– Ark extracts only the folder (not the files within the folder)

What I *expected/wished* would happen:
– Ark extracts the folder *including* its contents
Comment 1 Elvis Angelaccio 2018-05-27 09:23:37 UTC
What kind of archive? (tar/zip/rar?)
Comment 2 Øystein Steffensen-Alværvik 2018-05-27 09:32:32 UTC
(In reply to Elvis Angelaccio from comment #1)
> What kind of archive? (tar/zip/rar?)

I tried with a zip archive.
Comment 3 Øystein Steffensen-Alværvik 2018-05-27 09:48:11 UTC
I thought this was a feature, but since I cannot reproduce it right now it must be a bug. I am *certain* that this has happened several times for me before.
Comment 4 Elvis Angelaccio 2018-05-27 09:57:30 UTC
I also cannot reproduce by following the steps in the first comment.

If you find out how to reproduce, please reopen.
Comment 5 Øystein Steffensen-Alværvik 2018-06-16 16:51:25 UTC
Created attachment 113382 [details]
Problematic zip

I can reproduce the bug with this zip file.
Comment 6 Elvis Angelaccio 2018-06-17 08:43:30 UTC
Thanks for the test archive, I was able to reproduce the issue with the libzip plugin.
Comment 7 Elvis Angelaccio 2018-06-17 14:01:27 UTC
Git commit 9a349f680b1b38332511f4e4b674d736befbad4c by Elvis Angelaccio.
Committed on 17/06/2018 at 13:47.
Pushed by elvisangelaccio into branch 'Applications/18.04'.

libzip: fix extraction of folders without zip entry

Some zip archives may not have a zip entry for a folder, but only the
entries for the files within that folder.

The Part generates a fake `Archive::Entry` in such cases, which gets
added the to list of entries passed to the `ExtractJob`.

This is properly handled by unzip (which prints a "caution: filename not
matched" warning for the virtual entry) and 7z. However, the libzip
plugin would abort the whole extraction when it couldn't stat the
missing entry.

This patch just prints a warning when it detects a folder that cannot be
stat'd (due to the NOENT error), but the extraction will continue as normal.
FIXED-IN: 18.04.3

A  +-    --    autotests/kerfuffle/data/bug_#394542.zip
M  +10   -0    autotests/kerfuffle/extracttest.cpp
M  +4    -0    plugins/libzipplugin/libzipplugin.cpp

https://commits.kde.org/ark/9a349f680b1b38332511f4e4b674d736befbad4c