alexcrichton / tar-rs

Tar file reading/writing for Rust
https://docs.rs/tar
Apache License 2.0
625 stars 184 forks source link

feat: setting permission mask in `Entry` and `Archive` #330

Closed weihanglo closed 1 year ago

weihanglo commented 1 year ago

This is convenience when you want to disable some permission bits during unpacking. Currently only support Unix.

weihanglo commented 1 year ago

Another solution is that we can have a set_mask() function to set mask. It might also be useful when a user just wants to remove some permissions.

joshtriplett commented 1 year ago

@weihanglo I would suggest splitting the UNC path fix into a separate PR?

And I do think mask would be more convenient than mode, since then tar can still handle "executable or not" itself.

weihanglo commented 1 year ago

Thanks @joshtriplett. #331 has been created for UNC path fix.

And this PR is also switched to set_mask from set_mode. I am not sure about how that works on Windows though.

alexcrichton commented 1 year ago

Thanks! Right now the mask looks like it's inverted when applying against a mode, so could that be documented? Either that or could the mask not be inverted and the default mask is u32::MAX?

weihanglo commented 1 year ago

Thanks for the review! I went ahead with a logical notation. If you like not inverted one please let me know :)

weihanglo commented 1 year ago

Thank you so much Alex! Just a little wish: Could we have a new release for the latest patches? :)

alexcrichton commented 1 year ago

Sorry for the delay, but sure yeah published now.