Compute the saved image's sha256 in one pass, over the uncompressed stream #39
No reviewers
Labels
No labels
⏳in-progress
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Grey.ooo/someones.computer_agent!39
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/save-sha256-single-pass"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
dockercli.Savenow computes the sha256 of the saved image in one pass, teeingdocker save's stdout through a hasher while it gzips to disk, and returns the hex digestdirectly.
forward.go's separatesha256Filehelper, which re-opened and re-read the whole.tar.gzoff disk just to hash it afterSavehad already written it.what the platform's bundle manifest is keyed on, and gzip output varies with the
compressor's settings even for byte-identical input.
Why
One read instead of two, and a digest that means what the manifest actually needs it to mean.
Test plan
go build ./...go test ./internal/dockercli/...— green, updated to assert the returned sum matchesthe uncompressed payload's own sha256
go test ./internal/cli/...— one pre-existing, unrelated failure(
TestAppsDrawsApplicationsFromEveryPageNotJustTheFirst), confirmed present onmainbefore this change too; not touched here