Skip to content

Commit

Permalink
Merge pull request #257 from ktock/fixwhiteouterror
Browse files Browse the repository at this point in the history
imagemounter: Avoid error when whiteout target doesn't exist in the parent layers
  • Loading branch information
ktock authored Apr 11, 2024
2 parents 4c6f123 + 3e12957 commit d37d8e1
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions extras/imagemounter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -1806,18 +1806,20 @@ func (a *applier) ApplyNodes(nodes NodeLayer) error {
if _, err := walkDown(a.n, filepath.Join(dir, base[len(whiteoutPrefix):]), getnode); err == nil {
p, err := walkDown(a.n, dir, getnode)
if err != nil {
return fmt.Errorf("parent node of whiteout %q is not found: %w", w, err)
log.Printf("parent node of whiteout %q is not found: %v\n", w, err)
} else {
delete(p.children, base)
}
delete(p.children, base)
}
}
for _, w := range nodes.opaqueWhiteouts {
dir, _ := filepath.Split(w)
p, err := walkDown(a.n, dir, getnode)
if err != nil {
return fmt.Errorf("parent node of whiteout %q is not found: %w", w, err)
log.Printf("parent node of opaque whiteout %q is not found: %v\n", w, err)
} else {
p.children = nil
}
p.children = nil
}
var err error
a.n, err = mergeNode(a.n, nodes.node)
Expand Down

0 comments on commit d37d8e1

Please sign in to comment.