fix: emit valid, reproducible zip timestamps in bundle (#34) - #44
Merged
Conversation
ZipScripts used w.Create, which leaves the entry mtime at the zero value and encodes to the invalid DOS date 1980-00-00 (month 0, day 0). Switch to CreateHeader with a fixed valid timestamp (the DOS epoch) so bundle archives are well-formed for any consumer and byte-reproducible across builds. Method stays Deflate.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #34.
Problem
ZipScriptsusedw.Create, which leaves each entry's mtime at the zero value.archive/zipencodes that as the invalid DOS date1980-00-00(month 0, day 0). asobi_engine used to crash extracting these (file:write_file_info->badarg); asobi_engine#56 hardened the reader, but the producer still emits malformed archives for any other consumer/tooling.Fix
Switch to
w.CreateHeaderwith a fixed, valid timestamp (the DOS epoch,1980-01-01) andMethod: zip.Deflatepreserved. A fixed timestamp (rather thantime.Now()) also makes the bundle byte-reproducible across builds, so identical scripts produce identical archives.Tests
New
deploy_test.go:TestZipScriptsEmitsValidTimestamps— every entry has month/day >= 1 (i.e. not1980-00-00) and stays Deflate-compressed.TestZipScriptsIsReproducible— two zips of the same input are byte-identical.go build/go vet/go test/gofmtall clean.