Merge pull request #4428 from thaJeztah/bump_continuity

vendor: update containerd/continuity efbc4488d8fe1bdc16bde3b2d2990d9b3a899165
This commit is contained in:
Derek McGowan 2020-07-29 12:33:31 -07:00 committed by GitHub
commit c2a6f180d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 31 additions and 38 deletions

View File

@ -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

View File

@ -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,

View File

@ -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
}

View File

@ -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

View File

@ -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).

View File

@ -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

View File

@ -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(

View File

@ -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
}

View File

@ -1,6 +1,6 @@
module github.com/containerd/continuity
go 1.11
go 1.13
require (
bazil.org/fuse v0.0.0-20160811212531-371fbbdaa898

View File

@ -14,6 +14,7 @@
limitations under the License.
*/
//nolint:unused,deadcode
package continuity
import (

View File

@ -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 {

View File

@ -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
}

View File

@ -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
}

View File

@ -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

View File

@ -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