summaryrefslogtreecommitdiff
path: root/vendor/github.com/containerd/continuity
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2020-04-30 08:40:16 -0400
committerDaniel J Walsh <dwalsh@redhat.com>2020-05-01 15:00:33 -0400
commit97fcbfcbec4c754f2c5a71daadbf933a6ebb0634 (patch)
tree7a1011275dea1080277c0fc4f9761757a56aaf76 /vendor/github.com/containerd/continuity
parent4a2765c4989df88681c18333c1ae45017e09613a (diff)
downloadpodman-97fcbfcbec4c754f2c5a71daadbf933a6ebb0634.tar.gz
podman-97fcbfcbec4c754f2c5a71daadbf933a6ebb0634.tar.bz2
podman-97fcbfcbec4c754f2c5a71daadbf933a6ebb0634.zip
cgroupsns was not following containers.conf
Implement ParseCgroupsNamespace to handle defaults. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'vendor/github.com/containerd/continuity')
-rw-r--r--vendor/github.com/containerd/continuity/fs/copy.go6
-rw-r--r--vendor/github.com/containerd/continuity/fs/copy_linux.go5
-rw-r--r--vendor/github.com/containerd/continuity/fs/copy_unix.go2
-rw-r--r--vendor/github.com/containerd/continuity/fs/stat_darwinfreebsd.go (renamed from vendor/github.com/containerd/continuity/fs/stat_bsd.go)0
-rw-r--r--vendor/github.com/containerd/continuity/fs/stat_linuxopenbsd.go (renamed from vendor/github.com/containerd/continuity/fs/stat_linux.go)2
-rw-r--r--vendor/github.com/containerd/continuity/sysx/nodata_unix.go2
-rw-r--r--vendor/github.com/containerd/continuity/sysx/xattr.go68
7 files changed, 43 insertions, 42 deletions
diff --git a/vendor/github.com/containerd/continuity/fs/copy.go b/vendor/github.com/containerd/continuity/fs/copy.go
index ad61022ad..818bba2cd 100644
--- a/vendor/github.com/containerd/continuity/fs/copy.go
+++ b/vendor/github.com/containerd/continuity/fs/copy.go
@@ -80,7 +80,7 @@ func copyDirectory(dst, src string, inodes map[uint64]string, o *copyDirOpts) er
return errors.Wrapf(err, "failed to stat %s", src)
}
if !stat.IsDir() {
- return errors.Errorf("source is not directory")
+ return errors.Errorf("source %s is not directory", src)
}
if st, err := os.Stat(dst); err != nil {
@@ -104,6 +104,10 @@ 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 {
+ return errors.Wrap(err, "failed to copy xattrs")
+ }
+
for _, fi := range fis {
source := filepath.Join(src, fi.Name())
target := filepath.Join(dst, fi.Name())
diff --git a/vendor/github.com/containerd/continuity/fs/copy_linux.go b/vendor/github.com/containerd/continuity/fs/copy_linux.go
index 81c71522a..72bae7d4e 100644
--- a/vendor/github.com/containerd/continuity/fs/copy_linux.go
+++ b/vendor/github.com/containerd/continuity/fs/copy_linux.go
@@ -51,7 +51,10 @@ func copyFileInfo(fi os.FileInfo, name string) error {
}
}
- timespec := []unix.Timespec{unix.Timespec(StatAtime(st)), unix.Timespec(StatMtime(st))}
+ timespec := []unix.Timespec{
+ unix.NsecToTimespec(syscall.TimespecToNsec(StatAtime(st))),
+ unix.NsecToTimespec(syscall.TimespecToNsec(StatMtime(st))),
+ }
if err := unix.UtimesNanoAt(unix.AT_FDCWD, name, timespec, unix.AT_SYMLINK_NOFOLLOW); err != nil {
return errors.Wrapf(err, "failed to utime %s", name)
}
diff --git a/vendor/github.com/containerd/continuity/fs/copy_unix.go b/vendor/github.com/containerd/continuity/fs/copy_unix.go
index 73c01a46d..a5de89261 100644
--- a/vendor/github.com/containerd/continuity/fs/copy_unix.go
+++ b/vendor/github.com/containerd/continuity/fs/copy_unix.go
@@ -1,4 +1,4 @@
-// +build solaris darwin freebsd
+// +build darwin freebsd openbsd solaris
/*
Copyright The containerd Authors.
diff --git a/vendor/github.com/containerd/continuity/fs/stat_bsd.go b/vendor/github.com/containerd/continuity/fs/stat_darwinfreebsd.go
index cb7400a33..cb7400a33 100644
--- a/vendor/github.com/containerd/continuity/fs/stat_bsd.go
+++ b/vendor/github.com/containerd/continuity/fs/stat_darwinfreebsd.go
diff --git a/vendor/github.com/containerd/continuity/fs/stat_linux.go b/vendor/github.com/containerd/continuity/fs/stat_linuxopenbsd.go
index 4a678dd1f..c68df6e58 100644
--- a/vendor/github.com/containerd/continuity/fs/stat_linux.go
+++ b/vendor/github.com/containerd/continuity/fs/stat_linuxopenbsd.go
@@ -1,3 +1,5 @@
+// +build linux openbsd
+
/*
Copyright The containerd Authors.
diff --git a/vendor/github.com/containerd/continuity/sysx/nodata_unix.go b/vendor/github.com/containerd/continuity/sysx/nodata_unix.go
index b26f5b3d0..de4b3d50c 100644
--- a/vendor/github.com/containerd/continuity/sysx/nodata_unix.go
+++ b/vendor/github.com/containerd/continuity/sysx/nodata_unix.go
@@ -1,4 +1,4 @@
-// +build darwin freebsd
+// +build darwin freebsd openbsd
/*
Copyright The containerd Authors.
diff --git a/vendor/github.com/containerd/continuity/sysx/xattr.go b/vendor/github.com/containerd/continuity/sysx/xattr.go
index 9e4326dcf..db6fe70fe 100644
--- a/vendor/github.com/containerd/continuity/sysx/xattr.go
+++ b/vendor/github.com/containerd/continuity/sysx/xattr.go
@@ -20,7 +20,6 @@ package sysx
import (
"bytes"
- "syscall"
"golang.org/x/sys/unix"
)
@@ -66,60 +65,53 @@ func LGetxattr(path, attr string) ([]byte, error) {
return getxattrAll(path, attr, unix.Lgetxattr)
}
-const defaultXattrBufferSize = 5
+const defaultXattrBufferSize = 128
type listxattrFunc func(path string, dest []byte) (int, error)
func listxattrAll(path string, listFunc listxattrFunc) ([]string, error) {
- var p []byte // nil on first execution
-
- for {
- n, err := listFunc(path, p) // first call gets buffer size.
+ buf := make([]byte, defaultXattrBufferSize)
+ n, err := listFunc(path, buf)
+ for err == unix.ERANGE {
+ // Buffer too small, use zero-sized buffer to get the actual size
+ n, err = listFunc(path, []byte{})
if err != nil {
return nil, err
}
+ buf = make([]byte, n)
+ n, err = listFunc(path, buf)
+ }
+ if err != nil {
+ return nil, err
+ }
- if n > len(p) {
- p = make([]byte, n)
- continue
- }
-
- p = p[:n]
-
- ps := bytes.Split(bytes.TrimSuffix(p, []byte{0}), []byte{0})
- var entries []string
- for _, p := range ps {
- s := string(p)
- if s != "" {
- entries = append(entries, s)
- }
+ ps := bytes.Split(bytes.TrimSuffix(buf[:n], []byte{0}), []byte{0})
+ var entries []string
+ for _, p := range ps {
+ if len(p) > 0 {
+ entries = append(entries, string(p))
}
-
- return entries, nil
}
+
+ return entries, nil
}
type getxattrFunc func(string, string, []byte) (int, error)
func getxattrAll(path, attr string, getFunc getxattrFunc) ([]byte, error) {
- p := make([]byte, defaultXattrBufferSize)
- for {
- n, err := getFunc(path, attr, p)
+ buf := make([]byte, defaultXattrBufferSize)
+ n, err := getFunc(path, attr, buf)
+ for err == unix.ERANGE {
+ // Buffer too small, use zero-sized buffer to get the actual size
+ n, err = getFunc(path, attr, []byte{})
if err != nil {
- if errno, ok := err.(syscall.Errno); ok && errno == syscall.ERANGE {
- p = make([]byte, len(p)*2) // this can't be ideal.
- continue // try again!
- }
-
return nil, err
}
-
- // realloc to correct size and repeat
- if n > len(p) {
- p = make([]byte, n)
- continue
- }
-
- return p[:n], nil
+ buf = make([]byte, n)
+ n, err = getFunc(path, attr, buf)
+ }
+ if err != nil {
+ return nil, err
}
+ return buf[:n], nil
}