mirror of
https://github.com/containers/podman.git
synced 2025-07-04 01:48:28 +08:00
Merge pull request #7554 from vrothberg/follow-up-on-7444
make image parent check more robust
This commit is contained in:
@ -1247,11 +1247,14 @@ func areParentAndChild(parent, child *imgspecv1.Image) bool {
|
||||
// candidate parent's diff IDs, which together would have
|
||||
// controlled which layers were used
|
||||
|
||||
// issue #7444 describes a panic where the length of child.RootFS.DiffIDs
|
||||
// is checked but child is nil. Adding a simple band-aid approach to prevent
|
||||
// the problem until the origin of the problem can be worked out in the issue
|
||||
// itself.
|
||||
if child == nil || len(parent.RootFS.DiffIDs) > len(child.RootFS.DiffIDs) {
|
||||
// Both, child and parent, may be nil when the storage is left in an
|
||||
// incoherent state. Issue #7444 describes such a case when a build
|
||||
// has been killed.
|
||||
if child == nil || parent == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
if len(parent.RootFS.DiffIDs) > len(child.RootFS.DiffIDs) {
|
||||
return false
|
||||
}
|
||||
childUsesCandidateDiffs := true
|
||||
|
@ -32,8 +32,10 @@ func (t *layerTree) toOCI(ctx context.Context, i *Image) (*ociv1.Image, error) {
|
||||
oci, exists := t.ociCache[i.ID()]
|
||||
if !exists {
|
||||
oci, err = i.ociv1Image(ctx)
|
||||
if err == nil {
|
||||
t.ociCache[i.ID()] = oci
|
||||
}
|
||||
}
|
||||
return oci, err
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user