From 6f3c32eb18f0a604ba2638b6a9f19f8824412fd1 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Mon, 11 Nov 2013 17:39:19 +0100 Subject: [PATCH] archive.ApplyLayer() - handle directory whiteouts When directories are white-outed we can get called with the previously removed directories. Handle this with os.IsNotExist(error). --- archive/diff.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/archive/diff.go b/archive/diff.go index c06eddd2c8..dffb6c49be 100644 --- a/archive/diff.go +++ b/archive/diff.go @@ -20,6 +20,11 @@ func ApplyLayer(dest string, layer Archive) error { // Step 2: walk for whiteouts and apply them, removing them in the process err := filepath.Walk(dest, func(fullPath string, f os.FileInfo, err error) error { if err != nil { + if os.IsNotExist(err) { + // This happens in the case of whiteouts in parent dir removing a directory + // We just ignore it + return filepath.SkipDir + } return err }