diff --git a/pkg/commands/copy_test.go b/pkg/commands/copy_test.go index 92d27b8a8..c69d007db 100755 --- a/pkg/commands/copy_test.go +++ b/pkg/commands/copy_test.go @@ -62,6 +62,9 @@ func setupTestTemp() string { } cperr := filepath.Walk(srcPath, func(path string, info os.FileInfo, err error) error { + if err != nil { + return err + } if path != srcPath { if err != nil { return err diff --git a/pkg/util/fs_util.go b/pkg/util/fs_util.go index 3e4792932..137d4bb4b 100644 --- a/pkg/util/fs_util.go +++ b/pkg/util/fs_util.go @@ -188,7 +188,12 @@ func GetFSFromLayers(root string, layers []v1.Layer, opts ...FSOpt) ([]string, e // DeleteFilesystem deletes the extracted image file system func DeleteFilesystem() error { logrus.Info("Deleting filesystem...") - return filepath.Walk(constants.RootDir, func(path string, info os.FileInfo, _ error) error { + return filepath.Walk(constants.RootDir, func(path string, info os.FileInfo, err error) error { + if err != nil { + // ignore errors when deleting. + return nil + } + if CheckWhitelist(path) { if !isExist(path) { logrus.Debugf("Path %s whitelisted, but not exists", path)