Skip to content

Commit

Permalink
fix(gzip): change compression block size
Browse files Browse the repository at this point in the history
Several tools set this as the default value.

image/copy/copy.go
56:var compressionBufferSize = 1048576

skopeo/vendor/github.com/containers/image/v5/copy/compression.go
24:     compressionBufferSize = 1048576

Choosing a different value causes the final gzip'ed layer to become
different although the source tar is identical, causing an
content-addressable invariants to break.

Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>
  • Loading branch information
rchincha committed Oct 11, 2023
1 parent 782bbb1 commit fe16290
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mutate/compress.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func (gz gzipCompressor) Compress(reader io.Reader) (io.ReadCloser, error) {
pipeReader, pipeWriter := io.Pipe()

gzw := gzip.NewWriter(pipeWriter)
if err := gzw.SetConcurrency(256<<10, 2*runtime.NumCPU()); err != nil {
if err := gzw.SetConcurrency(256<<12, 2*runtime.NumCPU()); err != nil {
return nil, errors.Wrapf(err, "set concurrency level to %v blocks", 2*runtime.NumCPU())
}
go func() {
Expand Down

0 comments on commit fe16290

Please sign in to comment.