Procházet zdrojové kódy

vendor: github.com/containerd/continuity v0.3.0

full diff: https://github.com/containerd/continuity/compare/v0.2.2...v0.3.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sebastiaan van Stijn před 3 roky
rodič
revize
fca0c20cd4

+ 1 - 1
vendor.mod

@@ -19,7 +19,7 @@ require (
 	github.com/cloudflare/cfssl v0.0.0-20180323000720-5d63dbd981b5
 	github.com/containerd/cgroups v1.0.3
 	github.com/containerd/containerd v1.6.3
-	github.com/containerd/continuity v0.2.2
+	github.com/containerd/continuity v0.3.0
 	github.com/containerd/fifo v1.0.0
 	github.com/containerd/typeurl v1.0.2
 	github.com/coreos/go-systemd/v22 v22.3.2

+ 2 - 1
vendor.sum

@@ -243,8 +243,9 @@ github.com/containerd/continuity v0.0.0-20200710164510-efbc4488d8fe/go.mod h1:cE
 github.com/containerd/continuity v0.0.0-20201208142359-180525291bb7/go.mod h1:kR3BEg7bDFaEddKm54WSmrol1fKWDU1nKYkgrcgZT7Y=
 github.com/containerd/continuity v0.0.0-20210208174643-50096c924a4e/go.mod h1:EXlVlkqNba9rJe3j7w3Xa924itAMLgZH4UD/Q4PExuQ=
 github.com/containerd/continuity v0.1.0/go.mod h1:ICJu0PwR54nI0yPEnJ6jcS+J7CZAUXrLh8lPo2knzsM=
-github.com/containerd/continuity v0.2.2 h1:QSqfxcn8c+12slxwu00AtzXrsami0MJb/MQs9lOLHLA=
 github.com/containerd/continuity v0.2.2/go.mod h1:pWygW9u7LtS1o4N/Tn0FoCFDIXZ7rxcMX7HX1Dmibvk=
+github.com/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvAXZJ/eg=
+github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1Ag8espWhkykbPM=
 github.com/containerd/fifo v0.0.0-20180307165137-3d5202aec260/go.mod h1:ODA38xgv3Kuk8dQz2ZQXpnv/UZZUHUCL7pnLehbXgQI=
 github.com/containerd/fifo v0.0.0-20190226154929-a9fb20d87448/go.mod h1:ODA38xgv3Kuk8dQz2ZQXpnv/UZZUHUCL7pnLehbXgQI=
 github.com/containerd/fifo v0.0.0-20200410184934-f15a3290365b/go.mod h1:jPQ2IAeZRCYxpS/Cm1495vGFww6ecHmMk1YJH2Q5ln0=

+ 4 - 8
vendor/github.com/containerd/continuity/AUTHORS

@@ -1,8 +1,6 @@
-Aaron Lehmann <aaron.lehmann@docker.com>
+Aaron Lehmann <alehmann@netflix.com>
 Akash Gupta <akagup@microsoft.com>
 Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
-Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
-Akihiro Suda <suda.kyoto@gmail.com>
 Andrew Pennebaker <apennebaker@datapipe.com>
 Brandon Philips <brandon.philips@coreos.com>
 Brian Goff <cpuguy83@gmail.com>
@@ -10,9 +8,9 @@ Christopher Jones <tophj@linux.vnet.ibm.com>
 Daniel, Dao Quang Minh <dqminh89@gmail.com>
 Darren Stahl <darst@microsoft.com>
 Derek McGowan <derek@mcg.dev>
-Derek McGowan <derek@mcgstyle.net>
 Edward Pilatowicz <edward.pilatowicz@oracle.com>
 Fu Wei <fuweid89@gmail.com>
+Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
 Hajime Tazaki <thehajime@gmail.com>
 Ian Campbell <ijc@docker.com>
 Ivan Markin <sw@nogoegst.net>
@@ -20,20 +18,18 @@ Jacob Blain Christen <jacob@rancher.com>
 Justin Cormack <justin.cormack@docker.com>
 Justin Cummins <sul3n3t@gmail.com>
 Kasper Fabæch Brandt <poizan@poizan.dk>
+Kazuyoshi Kato <katokazu@amazon.com>
 Kir Kolyshkin <kolyshkin@gmail.com>
 Michael Crosby <crosbymichael@gmail.com>
-Michael Crosby <michael@thepasture.io>
 Michael Wan <zirenwan@gmail.com>
 Mike Brown <brownwm@us.ibm.com>
 Niels de Vos <ndevos@redhat.com>
-Phil Estes <estesp@amazon.com>
 Phil Estes <estesp@gmail.com>
-Phil Estes <estesp@linux.vnet.ibm.com>
 Sam Whited <sam@samwhited.com>
 Samuel Karp <me@samuelkarp.com>
 Sebastiaan van Stijn <github@gone.nl>
 Shengjing Zhu <zhsj@debian.org>
-Stephen J Day <stephen.day@docker.com>
+Stephen J Day <stevvooe@gmail.com>
 Tibor Vass <tibor@docker.com>
 Tobias Klauser <tklauser@distanz.ch>
 Tom Faulhaber <tffaulha@amazon.com>

+ 6 - 6
vendor/github.com/containerd/continuity/driver/driver_unix.go

@@ -54,7 +54,7 @@ func (d *driver) Mkfifo(path string, mode os.FileMode) error {
 func (d *driver) Getxattr(p string) (map[string][]byte, error) {
 	xattrs, err := sysx.Listxattr(p)
 	if err != nil {
-		return nil, fmt.Errorf("listing %s xattrs: %v", p, err)
+		return nil, fmt.Errorf("listing %s xattrs: %w", p, err)
 	}
 
 	sort.Strings(xattrs)
@@ -63,7 +63,7 @@ func (d *driver) Getxattr(p string) (map[string][]byte, error) {
 	for _, attr := range xattrs {
 		value, err := sysx.Getxattr(p, attr)
 		if err != nil {
-			return nil, fmt.Errorf("getting %q xattr on %s: %v", attr, p, err)
+			return nil, fmt.Errorf("getting %q xattr on %s: %w", attr, p, err)
 		}
 
 		// NOTE(stevvooe): This append/copy tricky relies on unique
@@ -82,7 +82,7 @@ func (d *driver) Getxattr(p string) (map[string][]byte, error) {
 func (d *driver) Setxattr(path string, attrMap map[string][]byte) error {
 	for attr, value := range attrMap {
 		if err := sysx.Setxattr(path, attr, value, 0); err != nil {
-			return fmt.Errorf("error setting xattr %q on %s: %v", attr, path, err)
+			return fmt.Errorf("error setting xattr %q on %s: %w", attr, path, err)
 		}
 	}
 
@@ -94,7 +94,7 @@ func (d *driver) Setxattr(path string, attrMap map[string][]byte) error {
 func (d *driver) LGetxattr(p string) (map[string][]byte, error) {
 	xattrs, err := sysx.LListxattr(p)
 	if err != nil {
-		return nil, fmt.Errorf("listing %s xattrs: %v", p, err)
+		return nil, fmt.Errorf("listing %s xattrs: %w", p, err)
 	}
 
 	sort.Strings(xattrs)
@@ -103,7 +103,7 @@ func (d *driver) LGetxattr(p string) (map[string][]byte, error) {
 	for _, attr := range xattrs {
 		value, err := sysx.LGetxattr(p, attr)
 		if err != nil {
-			return nil, fmt.Errorf("getting %q xattr on %s: %v", attr, p, err)
+			return nil, fmt.Errorf("getting %q xattr on %s: %w", attr, p, err)
 		}
 
 		// NOTE(stevvooe): This append/copy tricky relies on unique
@@ -122,7 +122,7 @@ func (d *driver) LGetxattr(p string) (map[string][]byte, error) {
 func (d *driver) LSetxattr(path string, attrMap map[string][]byte) error {
 	for attr, value := range attrMap {
 		if err := sysx.LSetxattr(path, attr, value, 0); err != nil {
-			return fmt.Errorf("error setting xattr %q on %s: %v", attr, path, err)
+			return fmt.Errorf("error setting xattr %q on %s: %w", attr, path, err)
 		}
 	}
 

+ 3 - 4
vendor/github.com/containerd/continuity/driver/utils.go

@@ -18,12 +18,11 @@ package driver
 
 import (
 	"io"
-	"io/ioutil"
 	"os"
 	"sort"
 )
 
-// ReadFile works the same as ioutil.ReadFile with the Driver abstraction
+// ReadFile works the same as os.ReadFile with the Driver abstraction
 func ReadFile(r Driver, filename string) ([]byte, error) {
 	f, err := r.Open(filename)
 	if err != nil {
@@ -31,7 +30,7 @@ func ReadFile(r Driver, filename string) ([]byte, error) {
 	}
 	defer f.Close()
 
-	data, err := ioutil.ReadAll(f)
+	data, err := io.ReadAll(f)
 	if err != nil {
 		return nil, err
 	}
@@ -39,7 +38,7 @@ func ReadFile(r Driver, filename string) ([]byte, error) {
 	return data, nil
 }
 
-// WriteFile works the same as ioutil.WriteFile with the Driver abstraction
+// WriteFile works the same as os.WriteFile with the Driver abstraction
 func WriteFile(r Driver, filename string, data []byte, perm os.FileMode) error {
 	f, err := r.OpenFile(filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, perm)
 	if err != nil {

+ 10 - 6
vendor/github.com/containerd/continuity/fs/copy.go

@@ -22,6 +22,8 @@ import (
 	"os"
 	"path/filepath"
 	"sync"
+
+	"github.com/sirupsen/logrus"
 )
 
 var bufferPool = &sync.Pool{
@@ -31,7 +33,7 @@ var bufferPool = &sync.Pool{
 	},
 }
 
-// XAttrErrorHandlers transform a non-nil xattr error.
+// XAttrErrorHandler transform a non-nil xattr error.
 // Return nil to ignore an error.
 // xattrKey can be empty for listxattr operation.
 type XAttrErrorHandler func(dst, src, xattrKey string, err error) error
@@ -152,13 +154,15 @@ func copyDirectory(dst, src string, inodes map[uint64]string, o *copyDirOpts) er
 			if err := os.Symlink(link, target); err != nil {
 				return fmt.Errorf("failed to create symlink: %s: %w", target, err)
 			}
-		case (fi.Mode() & os.ModeDevice) == os.ModeDevice:
-			if err := copyDevice(target, fi); err != nil {
-				return fmt.Errorf("failed to create device: %w", err)
+		case (fi.Mode() & os.ModeDevice) == os.ModeDevice,
+			(fi.Mode() & os.ModeNamedPipe) == os.ModeNamedPipe,
+			(fi.Mode() & os.ModeSocket) == os.ModeSocket:
+			if err := copyIrregular(target, fi); err != nil {
+				return fmt.Errorf("failed to create irregular file: %w", err)
 			}
 		default:
-			// TODO: Support pipes and sockets
-			return fmt.Errorf("unsupported mode %s: %w", fi.Mode(), err)
+			logrus.Warnf("unsupported mode: %s: %s", source, fi.Mode())
+			continue
 		}
 
 		if err := copyFileInfo(fi, source, target); err != nil {

+ 0 - 36
vendor/github.com/containerd/continuity/fs/copy_freebsd.go

@@ -1,36 +0,0 @@
-//go:build freebsd
-// +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 (
-	"errors"
-	"os"
-	"syscall"
-
-	"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)
-}

+ 10 - 10
vendor/github.com/containerd/continuity/fs/copy_darwin.go → vendor/github.com/containerd/continuity/fs/copy_irregular_freebsd.go

@@ -1,6 +1,3 @@
-//go:build darwin
-// +build darwin
-
 /*
    Copyright The containerd Authors.
 
@@ -20,17 +17,20 @@
 package fs
 
 import (
-	"errors"
+	"fmt"
 	"os"
 	"syscall"
-
-	"golang.org/x/sys/unix"
 )
 
-func copyDevice(dst string, fi os.FileInfo) error {
-	st, ok := fi.Sys().(*syscall.Stat_t)
+// copyIrregular covers devices, pipes, and sockets
+func copyIrregular(dst string, fi os.FileInfo) error {
+	st, ok := fi.Sys().(*syscall.Stat_t) // not *unix.Stat_t
 	if !ok {
-		return errors.New("unsupported stat type")
+		return fmt.Errorf("unsupported stat type: %s: %v", dst, fi.Mode())
+	}
+	var rDev uint64 // uint64 on FreeBSD, int on other unixen
+	if fi.Mode()&os.ModeDevice == os.ModeDevice {
+		rDev = st.Rdev
 	}
-	return unix.Mknod(dst, uint32(fi.Mode()), int(st.Rdev))
+	return syscall.Mknod(dst, uint32(st.Mode), rDev)
 }

+ 13 - 9
vendor/github.com/containerd/continuity/fs/copy_device_unix.go → vendor/github.com/containerd/continuity/fs/copy_irregular_unix.go

@@ -1,5 +1,5 @@
-//go:build openbsd || solaris || netbsd
-// +build openbsd solaris netbsd
+//go:build !windows && !freebsd
+// +build !windows,!freebsd
 
 /*
    Copyright The containerd Authors.
@@ -20,17 +20,21 @@
 package fs
 
 import (
-	"errors"
+	"fmt"
 	"os"
 	"syscall"
-
-	"golang.org/x/sys/unix"
 )
 
-func copyDevice(dst string, fi os.FileInfo) error {
-	st, ok := fi.Sys().(*syscall.Stat_t)
+// copyIrregular covers devices, pipes, and sockets
+func copyIrregular(dst string, fi os.FileInfo) error {
+	st, ok := fi.Sys().(*syscall.Stat_t) // not *unix.Stat_t
 	if !ok {
-		return errors.New("unsupported stat type")
+		return fmt.Errorf("unsupported stat type: %s: %v", dst, fi.Mode())
+	}
+	var rDev int
+	if fi.Mode()&os.ModeDevice == os.ModeDevice {
+		rDev = int(st.Rdev)
 	}
-	return unix.Mknod(dst, uint32(fi.Mode()), int(st.Rdev))
+	//nolint:unconvert
+	return syscall.Mknod(dst, uint32(st.Mode), rDev)
 }

+ 0 - 9
vendor/github.com/containerd/continuity/fs/copy_linux.go

@@ -17,7 +17,6 @@
 package fs
 
 import (
-	"errors"
 	"fmt"
 	"io"
 	"os"
@@ -144,11 +143,3 @@ func copyXAttrs(dst, src string, excludes map[string]struct{}, errorHandler XAtt
 
 	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))
-}

+ 2 - 2
vendor/github.com/containerd/continuity/fs/copy_windows.go

@@ -85,6 +85,6 @@ func copyXAttrs(dst, src string, excludes map[string]struct{}, errorHandler XAtt
 	return nil
 }
 
-func copyDevice(dst string, fi os.FileInfo) error {
-	return errors.New("device copy not supported")
+func copyIrregular(dst string, fi os.FileInfo) error {
+	return errors.New("irregular copy not supported")
 }

+ 1 - 2
vendor/github.com/containerd/continuity/fs/diff.go

@@ -22,9 +22,8 @@ import (
 	"path/filepath"
 	"strings"
 
-	"golang.org/x/sync/errgroup"
-
 	"github.com/sirupsen/logrus"
+	"golang.org/x/sync/errgroup"
 )
 
 // ChangeKind is the type of modification that

+ 1 - 1
vendor/github.com/containerd/continuity/fs/dtype_linux.go

@@ -35,7 +35,7 @@ func locateDummyIfEmpty(path string) (string, error) {
 	if len(children) != 0 {
 		return "", nil
 	}
-	dummyFile, err := ioutil.TempFile(path, "fsutils-dummy")
+	dummyFile, err := os.CreateTemp(path, "fsutils-dummy")
 	if err != nil {
 		return "", err
 	}

+ 0 - 52
vendor/github.com/containerd/continuity/sysx/generate.sh

@@ -1,52 +0,0 @@
-#!/bin/bash
-
-#   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.
-
-
-set -e
-
-mksyscall="$(go env GOROOT)/src/syscall/mksyscall.pl"
-
-fix() {
-	sed 's,^package syscall$,package sysx,' \
-		| sed 's,^import "unsafe"$,import (\n\t"syscall"\n\t"unsafe"\n),' \
-		| gofmt -r='BytePtrFromString -> syscall.BytePtrFromString' \
-		| gofmt -r='Syscall6 -> syscall.Syscall6' \
-		| gofmt -r='Syscall -> syscall.Syscall' \
-		| gofmt -r='SYS_GETXATTR -> syscall.SYS_GETXATTR' \
-		| gofmt -r='SYS_LISTXATTR -> syscall.SYS_LISTXATTR' \
-		| gofmt -r='SYS_SETXATTR -> syscall.SYS_SETXATTR' \
-		| gofmt -r='SYS_REMOVEXATTR -> syscall.SYS_REMOVEXATTR' \
-		| gofmt -r='SYS_LGETXATTR -> syscall.SYS_LGETXATTR' \
-		| gofmt -r='SYS_LLISTXATTR -> syscall.SYS_LLISTXATTR' \
-		| gofmt -r='SYS_LSETXATTR -> syscall.SYS_LSETXATTR' \
-		| gofmt -r='SYS_LREMOVEXATTR -> syscall.SYS_LREMOVEXATTR'
-}
-
-if [ "$GOARCH" == "" ] || [ "$GOOS" == "" ]; then
-	echo "Must specify \$GOARCH and \$GOOS"
-	exit 1
-fi
-
-mkargs=""
-
-if [ "$GOARCH" == "386" ] || [ "$GOARCH" == "arm" ]; then
-	mkargs="-l32"
-fi
-
-for f in "$@"; do
-	$mksyscall $mkargs "${f}_${GOOS}.go" | fix > "${f}_${GOOS}_${GOARCH}.go"
-done
-

+ 2 - 2
vendor/modules.txt

@@ -223,8 +223,8 @@ github.com/containerd/containerd/snapshots
 github.com/containerd/containerd/snapshots/proxy
 github.com/containerd/containerd/sys
 github.com/containerd/containerd/version
-# github.com/containerd/continuity v0.2.2
-## explicit; go 1.13
+# github.com/containerd/continuity v0.3.0
+## explicit; go 1.17
 github.com/containerd/continuity/devices
 github.com/containerd/continuity/driver
 github.com/containerd/continuity/fs