diff --git a/ext4/internal/compactext4/compact.go b/ext4/internal/compactext4/compact.go index d9a959ffeb..42ac190568 100644 --- a/ext4/internal/compactext4/compact.go +++ b/ext4/internal/compactext4/compact.go @@ -520,6 +520,9 @@ func (w *Writer) lookup(name string, mustExist bool) (*inode, *inode, string, er // call to make these parent directories will be made at a later point with the correct // permissions, at that time the permissions of these directories will be updated. func (w *Writer) CreateWithParents(name string, f *File) error { + if err := w.finishInode(); err != nil { + return err + } // go through the directories in the path one by one and create the // parent directories if they don't exist. cleanname := path.Clean("/" + name)[1:] diff --git a/ext4/tar2ext4/tar2ext4_test.go b/ext4/tar2ext4/tar2ext4_test.go index cfbb3ec669..9156326398 100644 --- a/ext4/tar2ext4/tar2ext4_test.go +++ b/ext4/tar2ext4/tar2ext4_test.go @@ -28,9 +28,9 @@ func Test_UnorderedTarExpansion(t *testing.T) { var files = []struct { path, body string }{ + {"foo/bar.txt", "inside bar.txt"}, {"data/", ""}, {"root.txt", "inside root.txt"}, - {"foo/bar.txt", "inside bar.txt"}, {"foo/", ""}, {"A/B/b.txt", "inside b.txt"}, {"A/a.txt", "inside a.txt"},