Skip to content

Commit 45f4f23

Browse files
committed
Don't completely ignore already-computed image size if we see an ALS layer
... but silently ignore the ALS layer. Also add a FIXME. Signed-off-by: Miloslav Trmač <[email protected]>
1 parent 27516f3 commit 45f4f23

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

storage/storage_src.go

+6-3
Original file line numberDiff line numberDiff line change
@@ -456,10 +456,13 @@ func (s *storageImageSource) getSize() (int64, error) {
456456
if (layer.TOCDigest == "" && layer.UncompressedDigest == "") || (layer.TOCDigest == "" && layer.UncompressedSize < 0) {
457457
return -1, fmt.Errorf("size for layer %q is unknown, failing getSize()", layerID)
458458
}
459-
if layer.UncompressedSize < 0 {
460-
sum = 0
459+
// FIXME: We allow layer.UncompressedSize < 0 above, because currently images in an Additional Layer Store don’t provide that value.
460+
// Right now, various callers in Podman (and, also, newImage in this package) don’t expect the size computation to fail.
461+
// Should we update the callers, or do we need to continue returning inaccurate information here? Or should we pay the cost
462+
// to compute the size from the diff?
463+
if layer.UncompressedSize >= 0 {
464+
sum += layer.UncompressedSize
461465
}
462-
sum += layer.UncompressedSize
463466
if layer.Parent == "" {
464467
break
465468
}

0 commit comments

Comments
 (0)