Skip to content

Commit

Permalink
Don't completely ignore already-computed image size if we see an ALS …
Browse files Browse the repository at this point in the history
…layer

... but silently ignore the ALS layer.

Also add a FIXME.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
  • Loading branch information
mtrmac committed May 20, 2024
1 parent 27516f3 commit 45f4f23
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions storage/storage_src.go
Original file line number Diff line number Diff line change
Expand Up @@ -456,10 +456,13 @@ func (s *storageImageSource) getSize() (int64, error) {
if (layer.TOCDigest == "" && layer.UncompressedDigest == "") || (layer.TOCDigest == "" && layer.UncompressedSize < 0) {
return -1, fmt.Errorf("size for layer %q is unknown, failing getSize()", layerID)
}
if layer.UncompressedSize < 0 {
sum = 0
// FIXME: We allow layer.UncompressedSize < 0 above, because currently images in an Additional Layer Store don’t provide that value.
// Right now, various callers in Podman (and, also, newImage in this package) don’t expect the size computation to fail.
// Should we update the callers, or do we need to continue returning inaccurate information here? Or should we pay the cost
// to compute the size from the diff?
if layer.UncompressedSize >= 0 {
sum += layer.UncompressedSize
}
sum += layer.UncompressedSize
if layer.Parent == "" {
break
}
Expand Down

0 comments on commit 45f4f23

Please sign in to comment.