Skip to content

Conversation

@abbeycode
Copy link
Owner

This PR takes @MartinLau7's changes from PR #84 and implements most (all?) of the feedback that came up during review. He should review this PR, and once he's good with it, I'll have him introduce a PR from a copy of this branch that will merge into the v1.9 branch.

MartinLau7 and others added 14 commits June 24, 2019 08:11
… idea, @MartinLau7, but it belongs in a separate PR. Let's work on that after we tackle the POSIX permissions changes
…using a bitmask instead of the original addition method
…(when none are specified) match previous releases. They didn't (were getting written with 0 permissions), and so I fixed with 0644, which is what the old behavior under previous versions did
…-[UZKArchiveTestCase archiveWIthFiles:password:]
…oads instead of unsigned long, moved the assignment of `external_fa` to the same method that writes the file date attribute, and added tests for writing buffered data with and without permissions
@abbeycode abbeycode added this to the 1.9 milestone Jun 25, 2019
@abbeycode
Copy link
Owner Author

@MartinLau7 I'm not able to assign this PR to you for review, but please let me know if it works for you, and comment regarding any changes you'd like to see. Please note that I removed the additional properties you added to UZKFileInfo. Those are a welcome suggestion, but should be in their own PR, since they're not related to archive permissions.

Copy link
Contributor

@MartinLau7 MartinLau7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have noticed that the new property is removed in this branch, waiting for the work of this branch to complete, and we continue to add new properties.

* key from the attributes NSFileManager returns. Assign in octal form, like 0777 in Objective-C or
* 0o777 in Swift
*/
@property (nonatomic, readonly) short posixPermissions;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why use "short" instead of "UInt32", I think "UInt32" would be better.

Copy link
Owner Author

@abbeycode abbeycode Jun 26, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The permissions NSFileManager returns are of the type short, or Int16 in Swift, as per the documentation.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh~ you are right.

_compressionMethod = [self readCompressionMethod:fileInfo->compression_method
flag:fileInfo->flag];

uLong permissions = (fileInfo->external_fa >> 16) & 0777U;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should avoid using such high permissions as 0777. It is recommended to use a maximum of 0755 permissions to prevent malicious code from being corrupted in the zip file.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're misunderstanding what this line does. It's applying a bit mask to the external_fa field, basically saying get rid of all bits from this field except the permission bits. I use 777 here because that turns on all of the permission bits, and leaves everything else off.

@MartinLau7

This comment has been minimized.

@abbeycode
Copy link
Owner Author

abbeycode commented Jun 27, 2019

@MartinLau7 I want to make sure you get the credit for this change (with your name on the commit), but I also want to squash it to a single commit. Can you clone my pr84 branch and submit a new PR to the v1.9 branch? I think that'll do it. (Also, please mark the conversations above as resolved if you are satisfied with my responses)

@MartinLau7
Copy link
Contributor

MartinLau7 commented Jun 27, 2019

@abbeycode Ok, I have cloned your PR84 to my repository and submitted a new Pull Request.(here)

abbeycode pushed a commit that referenced this pull request Jun 27, 2019
Adds support for archival and restoration of POSIX permissions, finishing the process that started across PRs #84 and #86
@abbeycode
Copy link
Owner Author

PR #87 was merged into the v1.9 branch, including these changes

@abbeycode abbeycode closed this Jun 27, 2019
@abbeycode abbeycode removed this from the 1.9 milestone Jun 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants