Skip to content

Commit

Permalink
chunked: flush the input tarball to the output
Browse files Browse the repository at this point in the history
Flush the entire input tarball to the output in the zstd:chunked
stream writer.  This is needed to include any trailing zeros that
affect the uncompressed digest.

Closes: containers#1771

Signed-off-by: Giuseppe Scrivano <[email protected]>
  • Loading branch information
giuseppe committed Dec 12, 2023
1 parent 2288d04 commit 79dee19
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/chunked/compressor/compressor.go
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,14 @@ func writeZstdChunkedStream(destFile io.Writer, outMetadata map[string]string, r
zstdWriter.Close()
return err
}

// make sure the entire tarball is flushed to the output as it might contain
// some trailing zeros that affect the checksum.
if _, err := io.Copy(zstdWriter, its); err != nil {
zstdWriter.Close()
return err
}

if err := zstdWriter.Flush(); err != nil {
zstdWriter.Close()
return err
Expand Down

0 comments on commit 79dee19

Please sign in to comment.