From 5b1627410df39295b69c4a0b47239591d09050b2 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 28 Jul 2020 16:39:35 +0200 Subject: [PATCH] vendor: update containerd/continuity efbc4488d8fe1bdc16bde3b2d2990d9b3a899165 full diff: https://github.com/containerd/continuity/compare/d3ef23f19fbb106bb73ffde425d07a9187e30745...efbc4488d8fe1bdc16bde3b2d2990d9b3a899165 Fix sameFile() to recognize empty files as the same - fixes "Empty files can diff as "modified" even when they're not" Signed-off-by: Sebastiaan van Stijn --- vendor.conf | 2 +- vendor/github.com/containerd/continuity/context.go | 8 +------- .../containerd/continuity/devices/devices_unix.go | 1 + vendor/github.com/containerd/continuity/digests.go | 10 +++------- .../containerd/continuity/driver/driver_windows.go | 4 ++-- .../continuity/fs/fstest/continuity_util.go | 4 ++-- .../containerd/continuity/fs/fstest/testsuite.go | 2 +- vendor/github.com/containerd/continuity/fs/path.go | 10 ++++------ vendor/github.com/containerd/continuity/go.mod | 2 +- .../github.com/containerd/continuity/groups_unix.go | 1 + vendor/github.com/containerd/continuity/hardlinks.go | 2 +- .../containerd/continuity/hardlinks_unix.go | 1 + vendor/github.com/containerd/continuity/manifest.go | 2 ++ .../containerd/continuity/sysx/xattr_unsupported.go | 12 ++++++------ .../continuity/testutil/loopback/loopback_linux.go | 8 ++++---- 15 files changed, 31 insertions(+), 38 deletions(-) diff --git a/vendor.conf b/vendor.conf index d9eea905f..df3272f31 100644 --- a/vendor.conf +++ b/vendor.conf @@ -4,7 +4,7 @@ github.com/cespare/xxhash/v2 v2.1.1 github.com/containerd/btrfs 153935315f4ab9be5bf03650a1341454b05efa5d github.com/containerd/cgroups 318312a373405e5e91134d8063d04d59768a1bff github.com/containerd/console v1.0.0 -github.com/containerd/continuity d3ef23f19fbb106bb73ffde425d07a9187e30745 +github.com/containerd/continuity efbc4488d8fe1bdc16bde3b2d2990d9b3a899165 github.com/containerd/fifo f15a3290365b9d2627d189e619ab4008e0069caf github.com/containerd/go-runc 7016d3ce2328dd2cb1192b2076ebd565c4e8df0c github.com/containerd/ttrpc v1.0.1 diff --git a/vendor/github.com/containerd/continuity/context.go b/vendor/github.com/containerd/continuity/context.go index 75c98594a..2166142c7 100644 --- a/vendor/github.com/containerd/continuity/context.go +++ b/vendor/github.com/containerd/continuity/context.go @@ -596,7 +596,7 @@ func (c *context) Walk(fn filepath.WalkFunc) error { return err } } - return c.pathDriver.Walk(root, func(p string, fi os.FileInfo, err error) error { + return c.pathDriver.Walk(root, func(p string, fi os.FileInfo, _ error) error { contained, err := c.containWithRoot(p, root) return fn(contained, fi, err) }) @@ -613,12 +613,6 @@ func (c *context) fullpath(p string) (string, error) { return p, nil } -// contain cleans and santizes the filesystem path p to be an absolute path, -// effectively relative to the context root. -func (c *context) contain(p string) (string, error) { - return c.containWithRoot(p, c.root) -} - // containWithRoot cleans and santizes the filesystem path p to be an absolute path, // effectively relative to the passed root. Extra care should be used when calling this // instead of contain. This is needed for Walk, as if context root is a symlink, diff --git a/vendor/github.com/containerd/continuity/devices/devices_unix.go b/vendor/github.com/containerd/continuity/devices/devices_unix.go index 520a5a6f3..950ebf1cd 100644 --- a/vendor/github.com/containerd/continuity/devices/devices_unix.go +++ b/vendor/github.com/containerd/continuity/devices/devices_unix.go @@ -32,6 +32,7 @@ func DeviceInfo(fi os.FileInfo) (uint64, uint64, error) { return 0, 0, fmt.Errorf("cannot extract device from os.FileInfo") } + //nolint:unconvert dev := uint64(sys.Rdev) return uint64(unix.Major(dev)), uint64(unix.Minor(dev)), nil } diff --git a/vendor/github.com/containerd/continuity/digests.go b/vendor/github.com/containerd/continuity/digests.go index bf92275db..c1b699fa7 100644 --- a/vendor/github.com/containerd/continuity/digests.go +++ b/vendor/github.com/containerd/continuity/digests.go @@ -88,13 +88,9 @@ func digestsMatch(as, bs []digest.Digest) bool { } disjoint := len(as) + len(bs) - if len(uniqified) == disjoint { - // if these two sets have the same cardinality, we know both sides - // didn't share any digests. - return false - } - - return true + // if these two sets have the same cardinality, we know both sides + // didn't share any digests. + return len(uniqified) != disjoint } type digestSlice []digest.Digest diff --git a/vendor/github.com/containerd/continuity/driver/driver_windows.go b/vendor/github.com/containerd/continuity/driver/driver_windows.go index c2a9a3b81..9baea3ba6 100644 --- a/vendor/github.com/containerd/continuity/driver/driver_windows.go +++ b/vendor/github.com/containerd/continuity/driver/driver_windows.go @@ -1,3 +1,5 @@ +// +build go1.13 + /* Copyright The containerd Authors. @@ -14,8 +16,6 @@ limitations under the License. */ -// +build go1.13 - // Go 1.13 is the minimally supported version for Windows. // Earlier golang releases have bug in os.Readlink // (see https://github.com/golang/go/issues/30463). diff --git a/vendor/github.com/containerd/continuity/fs/fstest/continuity_util.go b/vendor/github.com/containerd/continuity/fs/fstest/continuity_util.go index 4d30dd01f..3b687a64a 100644 --- a/vendor/github.com/containerd/continuity/fs/fstest/continuity_util.go +++ b/vendor/github.com/containerd/continuity/fs/fstest/continuity_util.go @@ -47,7 +47,7 @@ func (l resourceListDifference) HasDiff() bool { } for _, add := range l.Additions { - if ok, _ := metadataFiles[add.Path()]; !ok { + if ok := metadataFiles[add.Path()]; !ok { return true } } @@ -66,7 +66,7 @@ func (l resourceListDifference) String() string { for _, upt := range l.Updates { fmt.Fprintf(buf, "~ %s\n", upt.String()) } - return string(buf.Bytes()) + return buf.String() } // diffManifest compares two resource lists and returns the list diff --git a/vendor/github.com/containerd/continuity/fs/fstest/testsuite.go b/vendor/github.com/containerd/continuity/fs/fstest/testsuite.go index d465d219c..360ef5526 100644 --- a/vendor/github.com/containerd/continuity/fs/fstest/testsuite.go +++ b/vendor/github.com/containerd/continuity/fs/fstest/testsuite.go @@ -210,7 +210,7 @@ var ( } // Hardlink name before with modification - // Tests link is created for unmodified files when new hardlinked file is seen first + // Tests link is created for unmodified files when a new hard linked file is seen first hardlinkBeforeUnmodified = []Applier{ baseApplier, Apply( diff --git a/vendor/github.com/containerd/continuity/fs/path.go b/vendor/github.com/containerd/continuity/fs/path.go index 8863caa9d..c26be7989 100644 --- a/vendor/github.com/containerd/continuity/fs/path.go +++ b/vendor/github.com/containerd/continuity/fs/path.go @@ -117,15 +117,13 @@ func sameFile(f1, f2 *currentPath) (bool, error) { // If the timestamp may have been truncated in both of the // files, check content of file to determine difference if t1.Nanosecond() == 0 && t2.Nanosecond() == 0 { - var eq bool if (f1.f.Mode() & os.ModeSymlink) == os.ModeSymlink { - eq, err = compareSymlinkTarget(f1.fullPath, f2.fullPath) - } else if f1.f.Size() > 0 { - eq, err = compareFileContent(f1.fullPath, f2.fullPath) + return compareSymlinkTarget(f1.fullPath, f2.fullPath) } - if err != nil || !eq { - return eq, err + if f1.f.Size() == 0 { // if file sizes are zero length, the files are the same by definition + return true, nil } + return compareFileContent(f1.fullPath, f2.fullPath) } else if t1.Nanosecond() != t2.Nanosecond() { return false, nil } diff --git a/vendor/github.com/containerd/continuity/go.mod b/vendor/github.com/containerd/continuity/go.mod index 86a7f148c..75a061aaa 100644 --- a/vendor/github.com/containerd/continuity/go.mod +++ b/vendor/github.com/containerd/continuity/go.mod @@ -1,6 +1,6 @@ module github.com/containerd/continuity -go 1.11 +go 1.13 require ( bazil.org/fuse v0.0.0-20160811212531-371fbbdaa898 diff --git a/vendor/github.com/containerd/continuity/groups_unix.go b/vendor/github.com/containerd/continuity/groups_unix.go index 022d8ab78..7b8676749 100644 --- a/vendor/github.com/containerd/continuity/groups_unix.go +++ b/vendor/github.com/containerd/continuity/groups_unix.go @@ -14,6 +14,7 @@ limitations under the License. */ +//nolint:unused,deadcode package continuity import ( diff --git a/vendor/github.com/containerd/continuity/hardlinks.go b/vendor/github.com/containerd/continuity/hardlinks.go index d493dd777..e72c0e72c 100644 --- a/vendor/github.com/containerd/continuity/hardlinks.go +++ b/vendor/github.com/containerd/continuity/hardlinks.go @@ -53,7 +53,7 @@ func (hlm *hardlinkManager) Add(fi os.FileInfo, resource Resource) error { } // Merge processes the current state of the hardlink manager and merges any -// shared nodes into hardlinked resources. +// shared nodes into hard linked resources. func (hlm *hardlinkManager) Merge() ([]Resource, error) { var resources []Resource for key, linked := range hlm.hardlinks { diff --git a/vendor/github.com/containerd/continuity/hardlinks_unix.go b/vendor/github.com/containerd/continuity/hardlinks_unix.go index a15d1759e..7105a7cf5 100644 --- a/vendor/github.com/containerd/continuity/hardlinks_unix.go +++ b/vendor/github.com/containerd/continuity/hardlinks_unix.go @@ -48,5 +48,6 @@ func newHardlinkKey(fi os.FileInfo) (hardlinkKey, error) { return hardlinkKey{}, errNotAHardLink } + //nolint:unconvert return hardlinkKey{dev: uint64(sys.Dev), inode: uint64(sys.Ino)}, nil } diff --git a/vendor/github.com/containerd/continuity/manifest.go b/vendor/github.com/containerd/continuity/manifest.go index 8074bbfbb..299fbccee 100644 --- a/vendor/github.com/containerd/continuity/manifest.go +++ b/vendor/github.com/containerd/continuity/manifest.go @@ -114,11 +114,13 @@ func BuildManifest(ctx Context) (*Manifest, error) { } // merge and post-process the hardlinks. + // nolint:misspell hardlinked, err := hardlinks.Merge() if err != nil { return nil, err } + // nolint:misspell for _, resource := range hardlinked { resourcesByPath[resource.Path()] = resource } diff --git a/vendor/github.com/containerd/continuity/sysx/xattr_unsupported.go b/vendor/github.com/containerd/continuity/sysx/xattr_unsupported.go index c9ef3a1d2..f8fa8c63f 100644 --- a/vendor/github.com/containerd/continuity/sysx/xattr_unsupported.go +++ b/vendor/github.com/containerd/continuity/sysx/xattr_unsupported.go @@ -23,7 +23,7 @@ import ( "runtime" ) -var unsupported = errors.New("extended attributes unsupported on " + runtime.GOOS) +var errUnsupported = errors.New("extended attributes unsupported on " + runtime.GOOS) // Listxattr calls syscall listxattr and reads all content // and returns a string array @@ -33,17 +33,17 @@ func Listxattr(path string) ([]string, error) { // Removexattr calls syscall removexattr func Removexattr(path string, attr string) (err error) { - return unsupported + return errUnsupported } // Setxattr calls syscall setxattr func Setxattr(path string, attr string, data []byte, flags int) (err error) { - return unsupported + return errUnsupported } // Getxattr calls syscall getxattr func Getxattr(path, attr string) ([]byte, error) { - return []byte{}, unsupported + return []byte{}, errUnsupported } // LListxattr lists xattrs, not following symlinks @@ -53,12 +53,12 @@ func LListxattr(path string) ([]string, error) { // LRemovexattr removes an xattr, not following symlinks func LRemovexattr(path string, attr string) (err error) { - return unsupported + return errUnsupported } // LSetxattr sets an xattr, not following symlinks func LSetxattr(path string, attr string, data []byte, flags int) (err error) { - return unsupported + return errUnsupported } // LGetxattr gets an xattr, not following symlinks diff --git a/vendor/github.com/containerd/continuity/testutil/loopback/loopback_linux.go b/vendor/github.com/containerd/continuity/testutil/loopback/loopback_linux.go index c404c2699..c1750047c 100644 --- a/vendor/github.com/containerd/continuity/testutil/loopback/loopback_linux.go +++ b/vendor/github.com/containerd/continuity/testutil/loopback/loopback_linux.go @@ -22,8 +22,8 @@ import ( "io/ioutil" "os" "os/exec" - "syscall" "strings" + "syscall" "github.com/pkg/errors" "github.com/sirupsen/logrus" @@ -70,9 +70,9 @@ func New(size int64) (*Loopback, error) { } l := Loopback{ - File: file.Name(), + File: file.Name(), Device: deviceName, - close: cleanup, + close: cleanup, } return &l, nil } @@ -83,7 +83,7 @@ type Loopback struct { File string // Device is /dev/loopX Device string - close func() error + close func() error } // SoftSize returns st_size