"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "archive/tar_test.go" between
containerd-1.5.3.tar.gz and containerd-1.5.4.tar.gz

About: containerd is a container runtime with an emphasis on simplicity, robustness and portability.

tar_test.go  (containerd-1.5.3):tar_test.go  (containerd-1.5.4)
skipping to change at line 246 skipping to change at line 246
b, err := ioutil.ReadFile(filepath.Join(root, "etc", "unbroken")) b, err := ioutil.ReadFile(filepath.Join(root, "etc", "unbroken"))
if err != nil { if err != nil {
return errors.Wrap(err, "failed to read unbroken") return errors.Wrap(err, "failed to read unbroken")
} }
if string(b) != expected { if string(b) != expected {
return errors.Errorf("/etc/unbroken: unexpected value %s, expected %s", b, expected) return errors.Errorf("/etc/unbroken: unexpected value %s, expected %s", b, expected)
} }
return nil return nil
} }
errFileDiff := errors.New("files differ") errFileDiff := errors.New("files differ")
td, err := ioutil.TempDir("", "test-breakouts-")
if err != nil {
t.Fatal(err)
}
defer os.RemoveAll(td)
isSymlinkFile := func(f string) func(string) error { isSymlinkFile := func(f string) func(string) error {
return func(root string) error { return func(root string) error {
fi, err := os.Lstat(filepath.Join(root, f)) fi, err := os.Lstat(filepath.Join(root, f))
if err != nil { if err != nil {
return err return err
} }
if got := fi.Mode() & os.ModeSymlink; got != os.ModeSymli nk { if got := fi.Mode() & os.ModeSymlink; got != os.ModeSymli nk {
return errors.Errorf("%s should be symlink", fi.N ame()) return errors.Errorf("%s should be symlink", fi.N ame())
skipping to change at line 747 skipping to change at line 752
fstest.CreateDir("/etc/", 0755), fstest.CreateDir("/etc/", 0755),
fstest.CreateFile("/etc/passwd", []byte("all user s"), 0644), fstest.CreateFile("/etc/passwd", []byte("all user s"), 0644),
fstest.Symlink("/dne", "localetc"), fstest.Symlink("/dne", "localetc"),
), ),
w: tartest.TarAll( w: tartest.TarAll(
tc.File("dne/../.wh.etc", []byte{}, 0644), tc.File("dne/../.wh.etc", []byte{}, 0644),
), ),
// resolution ends up just removing etc // resolution ends up just removing etc
validator: fileNotExists("etc/passwd"), validator: fileNotExists("etc/passwd"),
}, },
{
name: "HardlinkSymlinkChmod",
w: func() tartest.WriterToTar {
p := filepath.Join(td, "perm400")
if err := ioutil.WriteFile(p, []byte("..."), 0400
); err != nil {
t.Fatal(err)
}
ep := filepath.Join(td, "also-exists-outside-root
")
if err := ioutil.WriteFile(ep, []byte("..."), 064
0); err != nil {
t.Fatal(err)
}
return tartest.TarAll(
tc.Symlink(p, ep),
tc.Link(ep, "sketchylink"),
)
}(),
validator: func(string) error {
p := filepath.Join(td, "perm400")
fi, err := os.Lstat(p)
if err != nil {
return err
}
if perm := fi.Mode() & os.ModePerm; perm != 0400
{
return errors.Errorf("%s perm changed fro
m 0400 to %04o", p, perm)
}
return nil
},
},
} }
for _, bo := range breakouts { for _, bo := range breakouts {
t.Run(bo.name, makeWriterToTarTest(bo.w, bo.apply, bo.validator, bo.err)) t.Run(bo.name, makeWriterToTarTest(bo.w, bo.apply, bo.validator, bo.err))
} }
} }
func TestDiffApply(t *testing.T) { func TestDiffApply(t *testing.T) {
fstest.FSSuite(t, diffApplier{}) fstest.FSSuite(t, diffApplier{})
} }
 End of changes. 2 change blocks. 
0 lines changed or deleted 40 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)