Skip to content
This repository has been archived by the owner on May 4, 2021. It is now read-only.

Commit

Permalink
Forgive the case when a whiteout file trying to cover nonexistent path (
Browse files Browse the repository at this point in the history
#361)

* Forgive the case when a whiteout file trying to cover nonexistent path

* Fix unit test
  • Loading branch information
yiranwang52 authored Mar 16, 2021
1 parent 821d255 commit 6dfcad3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/snapshot/mem_fs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ func TestUpdateMemFS(t *testing.T) {
require.Equal(os.ErrNotExist, err)
})

t.Run("WhiteoutNonexistentCausesError", func(t *testing.T) {
t.Run("WhiteoutNonexistentNotCausingError", func(t *testing.T) {
require := require.New(t)

tmpRoot, err := ioutil.TempDir("/tmp", "makisu-test")
Expand Down Expand Up @@ -333,7 +333,7 @@ func TestUpdateMemFS(t *testing.T) {
require.NoError(addDirectoryToLayer(l2, tmpRoot, dst21, 0755))
dst22 := "/test11/.wh.test13"
require.NoError(addDirectoryToLayer(l2, tmpRoot, dst22, 0755))
require.Error(fs.merge(l2))
require.NoError(fs.merge(l2))
})
}

Expand Down
5 changes: 4 additions & 1 deletion lib/snapshot/mem_layer.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"sort"
"strings"

"github.com/uber/makisu/lib/log"
"github.com/uber/makisu/lib/pathutils"
"github.com/uber/makisu/lib/tario"
)
Expand Down Expand Up @@ -114,7 +115,9 @@ func (f *whiteoutMemFile) updateMemFS(node *memFSNode) error {
if i != len(parts)-1 {
return fmt.Errorf("missing intermediate dir %s in %s", part, f.del)
}
return fmt.Errorf("whiteout nonexistent path %s", f.del)
// This could happen to files that's cleaned up in the background, like
// python package's .dist-info or .pth file.
log.Warnf("Trying to whiteout nonexistent path: %s", f.del)
}
}
return nil
Expand Down

0 comments on commit 6dfcad3

Please sign in to comment.