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

tar: Make all gzip compression hermetic #75

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

DolceTriade
Copy link

@DolceTriade DolceTriade commented Aug 17, 2024

We weren't passing the flag to make gzip hermetic. Without the flag to
ignore timestamp, the shasum will differ based on the system time.

Also, DEFAULT_ARGS contained "--options=gzip:...", which is invalid when
using any other compression scheme. Therefore, remove that option from
DEFAULT_ARGS and provide an alternate function called
add_default_compression_args to add per-compression type default
arguments which can do things like make the compression more hermetic.

Repro instructions:

bazel test //...
find -L bazel-bin -name "*.gz" -exec sha256sum {} \; > sha
bazel clean --expunge
bazel test //...
sha256sum -c sha

Before, the above test would fail with sha256sum mismatches. With this patch, all shasums match.

Copy link
Collaborator

@thesayyn thesayyn left a comment

Choose a reason for hiding this comment

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

Thanks!

@DolceTriade
Copy link
Author

tar: Unknown module name: `gzip'

Hm, I thought that the aspect build tar would support this universally?

We weren't passing the flag to make gzip hermetic. Without the flag to
ignore timestamp, the shasum will differ based on the system time.

Also, DEFAULT_ARGS contained "--options=gzip:...", which is invalid when
using any other compression scheme. Therefore, remove that option from
DEFAULT_ARGS and provide an alternate function called
`add_default_compression_args` to add per-compression type default
arguments which can do things like make the compression more hermetic.
@DolceTriade DolceTriade changed the title flatten: Make flatten hermetic tar: Make all gzip compression hermetic Aug 22, 2024
@DolceTriade
Copy link
Author

Ok, tests pass now. While running I realized a lot more than flatten was not hermetic, so I fixed those as well. Please let me know if you'd like a different approach. I also updated the commit message with the motivations.

@jjmaestro
Copy link
Contributor

I'd love to get this merged, I'm also using flatten and will need the hermeticity! :)

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