Bug 381499 - Zip: executable permission not set
Summary: Zip: executable permission not set
Status: RESOLVED FIXED
Alias: None
Product: ark
Classification: Applications
Component: plugins (other bugs)
Version First Reported In: 17.04.2
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Ragnar Thomsen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-06-21 18:26 UTC by cubobaky
Modified: 2017-06-29 20:25 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In: 17.07.80
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description cubobaky 2017-06-21 18:26:06 UTC
When extracting zip archives the executable permissions are not set.
It works fine using unzip directly or with other archive formats (7z/tar).
Comment 1 Elvis Angelaccio 2017-06-21 20:43:41 UTC
What zip plugin are you using? (You can check in Settings -> Configure Ark -> Plugin Settings)
Comment 2 cubobaky 2017-06-22 14:22:04 UTC
Libzip seems to be the issue, deactivating it fixed it.
Comment 3 Elvis Angelaccio 2017-06-27 13:51:11 UTC
Git commit 4738a2993207557263dbd8f131bc017d9f670a6b by Elvis Angelaccio.
Committed on 27/06/2017 at 13:47.
Pushed by elvisangelaccio into branch 'master'.

Test whether we preserve permissions upon extraction

The new test cases revelead the following bugs:

    FAIL!  : ExtractTest::testPreservePermissions(test preserve 0664 permissions (7z, kerfuffle_cli7z)) Compared values are not the same
    FAIL!  : ExtractTest::testPreservePermissions(test preserve 0664 permissions (tar.gz, kerfuffle_libarchive)) Compared values are not the same
    FAIL!  : ExtractTest::testPreservePermissions(test preserve 0755 permissions (zip, kerfuffle_libzip)) Compared values are not the same
    FAIL!  : ExtractTest::testPreservePermissions(test preserve 0664 permissions (zip, kerfuffle_libzip)) Compared values are not the same
    FAIL!  : ExtractTest::testPreservePermissions(test preserve 0664 permissions (zip, kerfuffle_cli7z)) Compared values are not the same

In the libzip case, we need to retrieve the permissions from the
extended file attributes.

M  +1    -1    autotests/kerfuffle/CMakeLists.txt
A  +-    --    autotests/kerfuffle/data/test_permissions.7z
A  +-    --    autotests/kerfuffle/data/test_permissions.rar
A  +-    --    autotests/kerfuffle/data/test_permissions.tar.gz
A  +-    --    autotests/kerfuffle/data/test_permissions.zip
M  +85   -0    autotests/kerfuffle/extracttest.cpp

https://commits.kde.org/ark/4738a2993207557263dbd8f131bc017d9f670a6b
Comment 4 Elvis Angelaccio 2017-06-29 17:20:03 UTC
Git commit d3a7d7bb5fd9f6cdce027748f4157b189dccdcef by Elvis Angelaccio.
Committed on 27/06/2017 at 14:04.
Pushed by elvisangelaccio into branch 'master'.

libzip: preserve permissions when extracting files

Summary:
The zip format reserves the 2 leftmost bytes of the extended file
attribute field (32 bits) for the UNIX permissions.
If the zip archive was crated with such metadata, we can just use the
libzip api to retrieve the extended file attribute and extract the
mode_t value from it.
FIXED-IN: 17.07.80

Test Plan: This fixes the 2 failing libzip test cases in ExtractTest::testPreservePermissions().

Reviewers: #ark, rthomsen

Subscribers: kde-utils-devel

Tags: #ark

Differential Revision: https://phabricator.kde.org/D6408

M  +1    -1    plugins/libzipplugin/CMakeLists.txt
M  +28   -0    plugins/libzipplugin/libzipplugin.cpp

https://commits.kde.org/ark/d3a7d7bb5fd9f6cdce027748f4157b189dccdcef
Comment 5 cubobaky 2017-06-29 20:25:28 UTC
Great, thanks for the quick fixing!