Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set Umask as part of archive.Extract #730

Merged
merged 2 commits into from
Oct 1, 2021
Merged

Set Umask as part of archive.Extract #730

merged 2 commits into from
Oct 1, 2021

Conversation

yaelharel
Copy link
Contributor

A different solution for #727.

@yaelharel
Copy link
Contributor Author

yaelharel commented Sep 30, 2021

@aemengo, we would love to get your feedback! Thanks!

Comment on lines +19 to +23
var (
umaskLock sync.Mutex
extractCounter int
originalUmask int
)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can put these three variables inside a private struct if anyone thinks it'll be clearer.
Or we can even move the variables and the related functions (setUmaskIfNeeded and unsetUmaskIfNeeded) to an internal package.

Personally, I don't think it's necessary but it's an option.

@yaelharel yaelharel force-pushed the umask branch 3 times, most recently from c8e5177 to 6e95ee6 Compare September 30, 2021 19:53
@natalieparellano
Copy link
Member

I think this is the best solution. This way we don't force the complexity of setting the umask on the caller. @yaelharel thank you for thinking of it!

Copy link
Contributor

@jabrown85 jabrown85 left a comment

Choose a reason for hiding this comment

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

I like it - it seems simpler than I initially figured it would end up. The complexity being trapped inside of Extract is probably the right move from an API perspective.

instead at the end of the function in case setUmask will panic.

Signed-off-by: Natalie Arellano <[email protected]>
@yaelharel yaelharel merged commit 33210c1 into release/0.12.0 Oct 1, 2021
@yaelharel yaelharel deleted the umask branch October 1, 2021 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants