Skip to content

fix: emit valid, reproducible zip timestamps in bundle (#34) - #44

Merged
Taure merged 1 commit into
mainfrom
fix/34-zip-timestamps
Jul 20, 2026
Merged

fix: emit valid, reproducible zip timestamps in bundle (#34)#44
Taure merged 1 commit into
mainfrom
fix/34-zip-timestamps

Conversation

@Taure

@Taure Taure commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Closes #34.

Problem

ZipScripts used w.Create, which leaves each entry's mtime at the zero value. archive/zip encodes that as the invalid DOS date 1980-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.CreateHeader with a fixed, valid timestamp (the DOS epoch, 1980-01-01) and Method: zip.Deflate preserved. A fixed timestamp (rather than time.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. not 1980-00-00) and stays Deflate-compressed.
  • TestZipScriptsIsReproducible — two zips of the same input are byte-identical.

go build / go vet / go test / gofmt all clean.

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.
@Taure
Taure merged commit 2860c55 into main Jul 20, 2026
1 check passed
@Taure
Taure deleted the fix/34-zip-timestamps branch July 20, 2026 20:21
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.

Bundle zip emits invalid DOS timestamps (1980-00-00)

1 participant