From 3e12957c7f60fc5e28ce477d0e6ecf9fbb26679a Mon Sep 17 00:00:00 2001 From: Kohei Tokunaga Date: Thu, 11 Apr 2024 21:03:05 +0900 Subject: [PATCH] Avoid error when whiteout target doesn't exist in the parent layers If we find a whiteout and the target (already) doesn't exist in the parent layers, we don't return error but just log it and continue processing. Signed-off-by: Kohei Tokunaga --- extras/imagemounter/main.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/extras/imagemounter/main.go b/extras/imagemounter/main.go index d63d1d83..c99cea50 100644 --- a/extras/imagemounter/main.go +++ b/extras/imagemounter/main.go @@ -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)