diff --git a/vendor.conf b/vendor.conf index 2c75425fa2e2..522041444d98 100644 --- a/vendor.conf +++ b/vendor.conf @@ -3,7 +3,7 @@ github.com/BurntSushi/toml v0.3.1 github.com/containerd/btrfs af5082808c833de0e79c1e72eea9fea239364877 github.com/containerd/cgroups 9f1c62dddf4bc7cc72822ebe353bae7006141b1b github.com/containerd/console v1.0.0 -github.com/containerd/continuity 1d9893e5674b5260c3fc11316d0d5fc0d12ea9e2 +github.com/containerd/continuity f93269e0d5c1e116e1c7f1f5af80eae9a75f988b https://github.com/k3s-io/continuity.git github.com/containerd/fifo bda0ff6ed73c67bfb5e62bc9c697f146b7fd7f13 github.com/containerd/go-runc e029b79d8cda8374981c64eba71f28ec38e5526f github.com/containerd/ttrpc v1.0.0 diff --git a/vendor/github.com/containerd/continuity/README.md b/vendor/github.com/containerd/continuity/README.md index f9f9ef0f9637..6fa50e159c70 100644 --- a/vendor/github.com/containerd/continuity/README.md +++ b/vendor/github.com/containerd/continuity/README.md @@ -63,6 +63,10 @@ $ stat -c %a Makefile $ ./bin/continuity verify . /tmp/a.pb ``` +## Platforms + +continuity primarily targets Linux. continuity may compile for and work on +other operating systems, but those platforms are not tested. ## Contribution Guide ### Building Proto Package diff --git a/vendor/github.com/containerd/continuity/devices/devices_unix.go b/vendor/github.com/containerd/continuity/devices/devices_unix.go index 950ebf1cd0d9..225a04b7fb41 100644 --- a/vendor/github.com/containerd/continuity/devices/devices_unix.go +++ b/vendor/github.com/containerd/continuity/devices/devices_unix.go @@ -56,7 +56,7 @@ func Mknod(p string, mode os.FileMode, maj, min int) error { m |= unix.S_IFIFO } - return unix.Mknod(p, m, int(dev)) + return mknod(p, m, dev) } // syscallMode returns the syscall-specific mode bits from Go's portable mode bits. diff --git a/vendor/github.com/containerd/continuity/devices/mknod_freebsd.go b/vendor/github.com/containerd/continuity/devices/mknod_freebsd.go new file mode 100644 index 000000000000..33d18ec8396b --- /dev/null +++ b/vendor/github.com/containerd/continuity/devices/mknod_freebsd.go @@ -0,0 +1,25 @@ +// +build freebsd + +/* + Copyright The containerd Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package devices + +import "golang.org/x/sys/unix" + +func mknod(path string, mode uint32, dev uint64) (err error) { + return unix.Mknod(path, mode, dev) +} diff --git a/vendor/github.com/containerd/continuity/devices/mknod_unix.go b/vendor/github.com/containerd/continuity/devices/mknod_unix.go new file mode 100644 index 000000000000..d9e7a7a2ba6a --- /dev/null +++ b/vendor/github.com/containerd/continuity/devices/mknod_unix.go @@ -0,0 +1,25 @@ +// +build linux darwin solaris + +/* + Copyright The containerd Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package devices + +import "golang.org/x/sys/unix" + +func mknod(path string, mode uint32, dev uint64) (err error) { + return unix.Mknod(path, mode, int(dev)) +} diff --git a/vendor/github.com/containerd/continuity/fs/copy.go b/vendor/github.com/containerd/continuity/fs/copy.go index 818bba2cda20..2ee77d1ab2a8 100644 --- a/vendor/github.com/containerd/continuity/fs/copy.go +++ b/vendor/github.com/containerd/continuity/fs/copy.go @@ -39,6 +39,8 @@ type XAttrErrorHandler func(dst, src, xattrKey string, err error) error type copyDirOpts struct { xeh XAttrErrorHandler + // xex contains a set of xattrs to exclude when copying + xex map[string]struct{} } type CopyDirOpt func(*copyDirOpts) error @@ -61,6 +63,19 @@ func WithAllowXAttrErrors() CopyDirOpt { return WithXAttrErrorHandler(xeh) } +// WithXAttrExclude allows for exclusion of specified xattr during CopyDir operation. +func WithXAttrExclude(keys ...string) CopyDirOpt { + return func(o *copyDirOpts) error { + if o.xex == nil { + o.xex = make(map[string]struct{}, len(keys)) + } + for _, key := range keys { + o.xex[key] = struct{}{} + } + return nil + } +} + // CopyDir copies the directory from src to dst. // Most efficient copy of files is attempted. func CopyDir(dst, src string, opts ...CopyDirOpt) error { @@ -104,7 +119,7 @@ func copyDirectory(dst, src string, inodes map[uint64]string, o *copyDirOpts) er return errors.Wrapf(err, "failed to copy file info for %s", dst) } - if err := copyXAttrs(dst, src, o.xeh); err != nil { + if err := copyXAttrs(dst, src, o.xex, o.xeh); err != nil { return errors.Wrap(err, "failed to copy xattrs") } @@ -150,7 +165,7 @@ func copyDirectory(dst, src string, inodes map[uint64]string, o *copyDirOpts) er return errors.Wrap(err, "failed to copy file info") } - if err := copyXAttrs(target, source, o.xeh); err != nil { + if err := copyXAttrs(target, source, o.xex, o.xeh); err != nil { return errors.Wrap(err, "failed to copy xattrs") } } diff --git a/vendor/github.com/containerd/continuity/fs/copy_darwinopenbsdsolaris.go b/vendor/github.com/containerd/continuity/fs/copy_darwinopenbsdsolaris.go new file mode 100644 index 000000000000..92ccacf9af36 --- /dev/null +++ b/vendor/github.com/containerd/continuity/fs/copy_darwinopenbsdsolaris.go @@ -0,0 +1,40 @@ +// +build darwin openbsd solaris + +/* + Copyright The containerd Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package fs + +import ( + "os" + "syscall" + + "github.com/pkg/errors" + "golang.org/x/sys/unix" +) + +func copyDevice(dst string, fi os.FileInfo) error { + st, ok := fi.Sys().(*syscall.Stat_t) + if !ok { + return errors.New("unsupported stat type") + } + return unix.Mknod(dst, uint32(fi.Mode()), int(st.Rdev)) +} + +func utimesNano(name string, atime, mtime syscall.Timespec) error { + timespec := []syscall.Timespec{atime, mtime} + return syscall.UtimesNano(name, timespec) +} diff --git a/vendor/github.com/containerd/continuity/fs/copy_freebsd.go b/vendor/github.com/containerd/continuity/fs/copy_freebsd.go new file mode 100644 index 000000000000..4b116c95e43d --- /dev/null +++ b/vendor/github.com/containerd/continuity/fs/copy_freebsd.go @@ -0,0 +1,42 @@ +// +build freebsd + +/* + Copyright The containerd Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package fs + +import ( + "os" + "syscall" + + "github.com/pkg/errors" + "golang.org/x/sys/unix" +) + +func copyDevice(dst string, fi os.FileInfo) error { + st, ok := fi.Sys().(*syscall.Stat_t) + if !ok { + return errors.New("unsupported stat type") + } + return unix.Mknod(dst, uint32(fi.Mode()), st.Rdev) +} + +func utimesNano(name string, atime, mtime syscall.Timespec) error { + at := unix.NsecToTimespec(atime.Nano()) + mt := unix.NsecToTimespec(mtime.Nano()) + utimes := [2]unix.Timespec{at, mt} + return unix.UtimesNanoAt(unix.AT_FDCWD, name, utimes[0:], unix.AT_SYMLINK_NOFOLLOW) +} diff --git a/vendor/github.com/containerd/continuity/fs/copy_linux.go b/vendor/github.com/containerd/continuity/fs/copy_linux.go index 72bae7d4e499..85beaee54a4a 100644 --- a/vendor/github.com/containerd/continuity/fs/copy_linux.go +++ b/vendor/github.com/containerd/continuity/fs/copy_linux.go @@ -104,21 +104,24 @@ func copyFileContent(dst, src *os.File) error { return nil } -func copyXAttrs(dst, src string, xeh XAttrErrorHandler) error { +func copyXAttrs(dst, src string, excludes map[string]struct{}, errorHandler XAttrErrorHandler) error { xattrKeys, err := sysx.LListxattr(src) if err != nil { e := errors.Wrapf(err, "failed to list xattrs on %s", src) - if xeh != nil { - e = xeh(dst, src, "", e) + if errorHandler != nil { + e = errorHandler(dst, src, "", e) } return e } for _, xattr := range xattrKeys { + if _, exclude := excludes[xattr]; exclude { + continue + } data, err := sysx.LGetxattr(src, xattr) if err != nil { e := errors.Wrapf(err, "failed to get xattr %q on %s", xattr, src) - if xeh != nil { - if e = xeh(dst, src, xattr, e); e == nil { + if errorHandler != nil { + if e = errorHandler(dst, src, xattr, e); e == nil { continue } } @@ -126,8 +129,8 @@ func copyXAttrs(dst, src string, xeh XAttrErrorHandler) error { } if err := sysx.LSetxattr(dst, xattr, data, 0); err != nil { e := errors.Wrapf(err, "failed to set xattr %q on %s", xattr, dst) - if xeh != nil { - if e = xeh(dst, src, xattr, e); e == nil { + if errorHandler != nil { + if e = errorHandler(dst, src, xattr, e); e == nil { continue } } diff --git a/vendor/github.com/containerd/continuity/fs/copy_unix.go b/vendor/github.com/containerd/continuity/fs/copy_unix.go index a5de89261f62..923dd5a982f2 100644 --- a/vendor/github.com/containerd/continuity/fs/copy_unix.go +++ b/vendor/github.com/containerd/continuity/fs/copy_unix.go @@ -25,7 +25,6 @@ import ( "github.com/containerd/continuity/sysx" "github.com/pkg/errors" - "golang.org/x/sys/unix" ) func copyFileInfo(fi os.FileInfo, name string) error { @@ -53,8 +52,7 @@ func copyFileInfo(fi os.FileInfo, name string) error { } } - timespec := []syscall.Timespec{StatAtime(st), StatMtime(st)} - if err := syscall.UtimesNano(name, timespec); err != nil { + if err := utimesNano(name, StatAtime(st), StatMtime(st)); err != nil { return errors.Wrapf(err, "failed to utime %s", name) } @@ -69,21 +67,24 @@ func copyFileContent(dst, src *os.File) error { return err } -func copyXAttrs(dst, src string, xeh XAttrErrorHandler) error { +func copyXAttrs(dst, src string, excludes map[string]struct{}, errorHandler XAttrErrorHandler) error { xattrKeys, err := sysx.LListxattr(src) if err != nil { e := errors.Wrapf(err, "failed to list xattrs on %s", src) - if xeh != nil { - e = xeh(dst, src, "", e) + if errorHandler != nil { + e = errorHandler(dst, src, "", e) } return e } for _, xattr := range xattrKeys { + if _, exclude := excludes[xattr]; exclude { + continue + } data, err := sysx.LGetxattr(src, xattr) if err != nil { e := errors.Wrapf(err, "failed to get xattr %q on %s", xattr, src) - if xeh != nil { - if e = xeh(dst, src, xattr, e); e == nil { + if errorHandler != nil { + if e = errorHandler(dst, src, xattr, e); e == nil { continue } } @@ -91,8 +92,8 @@ func copyXAttrs(dst, src string, xeh XAttrErrorHandler) error { } if err := sysx.LSetxattr(dst, xattr, data, 0); err != nil { e := errors.Wrapf(err, "failed to set xattr %q on %s", xattr, dst) - if xeh != nil { - if e = xeh(dst, src, xattr, e); e == nil { + if errorHandler != nil { + if e = errorHandler(dst, src, xattr, e); e == nil { continue } } @@ -102,11 +103,3 @@ func copyXAttrs(dst, src string, xeh XAttrErrorHandler) error { return nil } - -func copyDevice(dst string, fi os.FileInfo) error { - st, ok := fi.Sys().(*syscall.Stat_t) - if !ok { - return errors.New("unsupported stat type") - } - return unix.Mknod(dst, uint32(fi.Mode()), int(st.Rdev)) -} diff --git a/vendor/github.com/containerd/continuity/fs/copy_windows.go b/vendor/github.com/containerd/continuity/fs/copy_windows.go index 27c7d7dbb9f3..0081583fd019 100644 --- a/vendor/github.com/containerd/continuity/fs/copy_windows.go +++ b/vendor/github.com/containerd/continuity/fs/copy_windows.go @@ -40,7 +40,7 @@ func copyFileContent(dst, src *os.File) error { return err } -func copyXAttrs(dst, src string, xeh XAttrErrorHandler) error { +func copyXAttrs(dst, src string, excludes map[string]struct{}, errorHandler XAttrErrorHandler) error { return nil } diff --git a/vendor/github.com/containerd/continuity/fs/du_unix.go b/vendor/github.com/containerd/continuity/fs/du_unix.go index 42352de876fb..9da43d1bc8e9 100644 --- a/vendor/github.com/containerd/continuity/fs/du_unix.go +++ b/vendor/github.com/containerd/continuity/fs/du_unix.go @@ -41,9 +41,9 @@ type inode struct { func newInode(stat *syscall.Stat_t) inode { return inode{ - // Dev is uint32 on darwin/bsd, uint64 on linux/solaris + // Dev is uint32 on darwin/bsd, uint64 on linux/solaris/freebsd dev: uint64(stat.Dev), // nolint: unconvert - // Ino is uint32 on bsd, uint64 on darwin/linux/solaris + // Ino is uint32 on bsd, uint64 on darwin/linux/solaris/freebsd ino: uint64(stat.Ino), // nolint: unconvert } } diff --git a/vendor/github.com/containerd/continuity/fs/fstest/file_unix.go b/vendor/github.com/containerd/continuity/fs/fstest/file_unix.go index c10e99ef27c9..9451198bb703 100644 --- a/vendor/github.com/containerd/continuity/fs/fstest/file_unix.go +++ b/vendor/github.com/containerd/continuity/fs/fstest/file_unix.go @@ -29,7 +29,8 @@ import ( // SetXAttr sets the xatter for the file func SetXAttr(name, key, value string) Applier { return applyFn(func(root string) error { - return sysx.LSetxattr(name, key, []byte(value), 0) + path := filepath.Join(root, name) + return sysx.LSetxattr(path, key, []byte(value), 0) }) } diff --git a/vendor/github.com/containerd/continuity/go.mod b/vendor/github.com/containerd/continuity/go.mod index 74f83dcfef2b..8587a8df8237 100644 --- a/vendor/github.com/containerd/continuity/go.mod +++ b/vendor/github.com/containerd/continuity/go.mod @@ -9,7 +9,7 @@ require ( github.com/inconshreveable/mousetrap v1.0.0 // indirect github.com/opencontainers/go-digest v1.0.0 github.com/pkg/errors v0.9.1 - github.com/sirupsen/logrus v1.6.0 + github.com/sirupsen/logrus v1.7.0 github.com/spf13/cobra v0.0.2-0.20171109065643-2da4a54c5cee github.com/spf13/pflag v1.0.1-0.20171106142849-4c012f6dcd95 // indirect github.com/stretchr/testify v1.4.0 // indirect