Repository navigation
Set Owner Permissions on extracted files - #26
Conversation
|
@tmortiboy if you rebase this to |
|
@hvr tests are now passing. |
|
One thing I'm not sure about is that
which seems to imply this was a deliberate design choice to omit restoring permissions. So maybe a compromise would be to make this behaviour configurable. I'm waiting for @dcoutts to chime in... |
|
As a user of the |
|
Why is this PR still not merged (or declined)? It's been 2 years.
It says "exact permissions are not preserved", not that none are preserved. https://hackage.haskell.org/package/tar-bytestring-0.6.1.3/docs/Codec-Archive-Tar.html#v:create specifically talks about the executable bit for creating tars. But then extract throws it away, which doesn't make sense. |
This fixes haskell#26 from upstream, but cleaner, since we don't need to use directory package.
| unpackEntries links Done = return links | ||
| unpackEntries links (Next entry es) = case entryContent entry of | ||
| NormalFile file _ -> extractFile path file mtime | ||
| NormalFile file _ -> extractFile entry path file mtime |
There was a problem hiding this comment.
If extractFile uses only entryPermissions entry, could we please make it explicit by passing this field only instead of whole entry?
| where | ||
| #if MIN_VERSION_directory(1,1,0) | ||
| ownerPermissions = | ||
| setOwnerReadable (testBit permissions 8) $ |
There was a problem hiding this comment.
- Let's float parsing
permissionsout of CPP conditions. - It would be nice to quote a source of magic numbers in comments. Not sure which is the best one, maybe https://www.gnu.org/software/libc/manual/html_node/Permission-Bits.html.
|
@hasufell Unfortunately I have a limited bandwidth to do work myself, but yes, if @tmortiboy has lost interest (which is quite understandable after all this time), we should make amends from our side next week. I'm pretty nervous about testing, to be honest. This PR is probably reasonably simple to proceed as is, but stuff like #42 needs regression tests. |
|
Happy to make the requested changes. Just need a few days to find some time. Thanks! |
|
Thanks @tmortiboy! |
This was a bug in the `tar` package that is fixed in haskell/tar#26. However, this code has not been released, so we need to grab the latest commit instead.
Fixes Issue 25: Extracted executable files do not have the executable flag set.
I've used
setPermissionfromSystem.Directoryas this is a portable way to set the owner permissions and requires no extra dependencies.Even before I made my changes, I cant get the property tests to pass and not sure whats broken there.