Merge pull request #1484 from thaJeztah/bump_containerd

vendor: containerd/containerd v1.4.0-beta.0
This commit is contained in:
Mike Brown 2020-05-18 08:11:36 -05:00 committed by GitHub
commit dc81240a6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
37 changed files with 215 additions and 467 deletions

View File

@ -9,10 +9,10 @@ github.com/BurntSushi/toml 3012a1dbe2e4bd1391d42b32f057
github.com/cespare/xxhash/v2 d7df74196a9e781ede915320c11c378c1b2f3a1f # v2.1.1 github.com/cespare/xxhash/v2 d7df74196a9e781ede915320c11c378c1b2f3a1f # v2.1.1
github.com/containerd/cgroups b4448137398923af7f4918b8b2ad8249172ca7a6 github.com/containerd/cgroups b4448137398923af7f4918b8b2ad8249172ca7a6
github.com/containerd/console 8375c3424e4d7b114e8a90a4a40c8e1b40d1d4e6 # v1.0.0 github.com/containerd/console 8375c3424e4d7b114e8a90a4a40c8e1b40d1d4e6 # v1.0.0
github.com/containerd/containerd ed261720c86d1e700cd5d39175128322baac6dda github.com/containerd/containerd 32985949d4f2f38a484c5021766251250764322b # v1.4.0-beta.0
github.com/containerd/continuity 0ec596719c75bfd42908850990acea594b7593ac github.com/containerd/continuity d3ef23f19fbb106bb73ffde425d07a9187e30745
github.com/containerd/fifo bda0ff6ed73c67bfb5e62bc9c697f146b7fd7f13 github.com/containerd/fifo f15a3290365b9d2627d189e619ab4008e0069caf
github.com/containerd/go-runc a5c2862aed5e6358b305b0e16bfce58e0549b1cd github.com/containerd/go-runc 7016d3ce2328dd2cb1192b2076ebd565c4e8df0c
github.com/containerd/ttrpc 72bb1b21c5b0a4a107f59dd85f6ab58e564b68d6 # v1.0.1 github.com/containerd/ttrpc 72bb1b21c5b0a4a107f59dd85f6ab58e564b68d6 # v1.0.1
github.com/containerd/typeurl cd3ce7159eae562a4f60ceff37dada11a939d247 # v1.0.1 github.com/containerd/typeurl cd3ce7159eae562a4f60ceff37dada11a939d247 # v1.0.1
github.com/coreos/go-systemd/v22 2d78030078ef61b3cae27f42ad6d0e46db51b339 # v22.0.0 github.com/coreos/go-systemd/v22 2d78030078ef61b3cae27f42ad6d0e46db51b339 # v22.0.0
@ -34,7 +34,7 @@ github.com/konsorten/go-windows-terminal-sequences edb144dfd453055e1e49a3d8b410
github.com/matttproud/golang_protobuf_extensions c12348ce28de40eed0136aa2b644d0ee0650e56c # v1.0.1 github.com/matttproud/golang_protobuf_extensions c12348ce28de40eed0136aa2b644d0ee0650e56c # v1.0.1
github.com/Microsoft/go-winio 6c72808b55902eae4c5943626030429ff20f3b63 # v0.4.14 github.com/Microsoft/go-winio 6c72808b55902eae4c5943626030429ff20f3b63 # v0.4.14
github.com/Microsoft/hcsshim 5bc557dd210ff2caf615e6e22d398123de77fc11 # v0.8.9 github.com/Microsoft/hcsshim 5bc557dd210ff2caf615e6e22d398123de77fc11 # v0.8.9
github.com/opencontainers/go-digest 28d3ccc31a47933556673856d9807b4ca436108e github.com/opencontainers/go-digest ea51bea511f75cfa3ef6098cc253c5c3609b037a # v1.0.0
github.com/opencontainers/image-spec d60099175f88c47cd379c4738d158884749ed235 # v1.0.1 github.com/opencontainers/image-spec d60099175f88c47cd379c4738d158884749ed235 # v1.0.1
github.com/opencontainers/runc dc9208a3303feef5b3839f4323d9beb36df0a9dd # v1.0.0-rc10 github.com/opencontainers/runc dc9208a3303feef5b3839f4323d9beb36df0a9dd # v1.0.0-rc10
github.com/opencontainers/runtime-spec c4ee7d12c742ffe806cd9350b6af3b4b19faed6f # v1.0.2 github.com/opencontainers/runtime-spec c4ee7d12c742ffe806cd9350b6af3b4b19faed6f # v1.0.2
@ -66,7 +66,7 @@ github.com/emicklei/go-restful b993709ae1a4f6dd19cfa4752326
github.com/google/gofuzz db92cf7ae75e4a7a28abc005addab2b394362888 # v1.1.0 github.com/google/gofuzz db92cf7ae75e4a7a28abc005addab2b394362888 # v1.1.0
github.com/json-iterator/go 03217c3e97663914aec3faafde50d081f197a0a2 # v1.1.8 github.com/json-iterator/go 03217c3e97663914aec3faafde50d081f197a0a2 # v1.1.8
github.com/modern-go/concurrent bacd9c7ef1dd9b15be4a9909b8ac7a4e313eec94 # 1.0.3 github.com/modern-go/concurrent bacd9c7ef1dd9b15be4a9909b8ac7a4e313eec94 # 1.0.3
github.com/modern-go/reflect2 4b7aa43c6742a2c18fdef89dd197aaae7dac7ccd # 1.0.1 github.com/modern-go/reflect2 94122c33edd36123c84d5368cfb2b69df93a0ec8 # v1.0.1
github.com/pmezard/go-difflib 792786c7400a136282c1664665ae0a8db921c6c2 # v1.0.0 github.com/pmezard/go-difflib 792786c7400a136282c1664665ae0a8db921c6c2 # v1.0.0
github.com/seccomp/libseccomp-golang 689e3c1541a84461afc49c1c87352a6cedf72e9c # v0.9.1 github.com/seccomp/libseccomp-golang 689e3c1541a84461afc49c1c87352a6cedf72e9c # v0.9.1
github.com/stretchr/testify 221dbe5ed46703ee255b1da0dec05086f5035f62 # v1.4.0 github.com/stretchr/testify 221dbe5ed46703ee255b1da0dec05086f5035f62 # v1.4.0

View File

@ -154,7 +154,7 @@ Taking a container object and turning it into a runnable process on a system is
```go ```go
// create a new task // create a new task
task, err := redis.NewTask(context, cio.Stdio) task, err := redis.NewTask(context, cio.NewCreator(cio.WithStdio))
defer task.Delete(context) defer task.Delete(context)
// the task is now running and has a pid that can be use to setup networking // the task is now running and has a pid that can be use to setup networking
@ -184,7 +184,7 @@ checkpoint, err := client.Pull(context, "myregistry/checkpoints/redis:master")
redis, err = client.NewContainer(context, "redis-master", containerd.WithNewSnapshot("redis-rootfs", checkpoint)) redis, err = client.NewContainer(context, "redis-master", containerd.WithNewSnapshot("redis-rootfs", checkpoint))
defer container.Delete(context) defer container.Delete(context)
task, err = redis.NewTask(context, cio.Stdio, containerd.WithTaskCheckpoint(checkpoint)) task, err = redis.NewTask(context, cio.NewCreator(cio.WithStdio), containerd.WithTaskCheckpoint(checkpoint))
defer task.Delete(context) defer task.Delete(context)
err := task.Start(context) err := task.Start(context)

View File

@ -361,7 +361,7 @@ func createTarFile(ctx context.Context, path, extractDir string, hdr *tar.Header
if strings.HasPrefix(key, paxSchilyXattr) { if strings.HasPrefix(key, paxSchilyXattr) {
key = key[len(paxSchilyXattr):] key = key[len(paxSchilyXattr):]
if err := setxattr(path, key, value); err != nil { if err := setxattr(path, key, value); err != nil {
if errors.Cause(err) == syscall.ENOTSUP { if errors.Is(err, syscall.ENOTSUP) {
log.G(ctx).WithError(err).Warnf("ignored xattr %s in archive", key) log.G(ctx).WithError(err).Warnf("ignored xattr %s in archive", key)
continue continue
} }

View File

@ -226,7 +226,7 @@ func WithContainerExtension(name string, extension interface{}) NewContainerOpts
any, err := typeurl.MarshalAny(extension) any, err := typeurl.MarshalAny(extension)
if err != nil { if err != nil {
if errors.Cause(err) == typeurl.ErrNotFound { if errors.Is(err, typeurl.ErrNotFound) {
return errors.Wrapf(err, "extension %q is not registered with the typeurl package, see `typeurl.Register`", name) return errors.Wrapf(err, "extension %q is not registered with the typeurl package, see `typeurl.Register`", name)
} }
return errors.Wrap(err, "error marshalling extension") return errors.Wrap(err, "error marshalling extension")

View File

@ -51,43 +51,43 @@ var (
// IsInvalidArgument returns true if the error is due to an invalid argument // IsInvalidArgument returns true if the error is due to an invalid argument
func IsInvalidArgument(err error) bool { func IsInvalidArgument(err error) bool {
return errors.Cause(err) == ErrInvalidArgument return errors.Is(err, ErrInvalidArgument)
} }
// IsNotFound returns true if the error is due to a missing object // IsNotFound returns true if the error is due to a missing object
func IsNotFound(err error) bool { func IsNotFound(err error) bool {
return errors.Cause(err) == ErrNotFound return errors.Is(err, ErrNotFound)
} }
// IsAlreadyExists returns true if the error is due to an already existing // IsAlreadyExists returns true if the error is due to an already existing
// metadata item // metadata item
func IsAlreadyExists(err error) bool { func IsAlreadyExists(err error) bool {
return errors.Cause(err) == ErrAlreadyExists return errors.Is(err, ErrAlreadyExists)
} }
// IsFailedPrecondition returns true if an operation could not proceed to the // IsFailedPrecondition returns true if an operation could not proceed to the
// lack of a particular condition // lack of a particular condition
func IsFailedPrecondition(err error) bool { func IsFailedPrecondition(err error) bool {
return errors.Cause(err) == ErrFailedPrecondition return errors.Is(err, ErrFailedPrecondition)
} }
// IsUnavailable returns true if the error is due to a resource being unavailable // IsUnavailable returns true if the error is due to a resource being unavailable
func IsUnavailable(err error) bool { func IsUnavailable(err error) bool {
return errors.Cause(err) == ErrUnavailable return errors.Is(err, ErrUnavailable)
} }
// IsNotImplemented returns true if the error is due to not being implemented // IsNotImplemented returns true if the error is due to not being implemented
func IsNotImplemented(err error) bool { func IsNotImplemented(err error) bool {
return errors.Cause(err) == ErrNotImplemented return errors.Is(err, ErrNotImplemented)
} }
// IsCanceled returns true if the error is due to `context.Canceled`. // IsCanceled returns true if the error is due to `context.Canceled`.
func IsCanceled(err error) bool { func IsCanceled(err error) bool {
return errors.Cause(err) == context.Canceled return errors.Is(err, context.Canceled)
} }
// IsDeadlineExceeded returns true if the error is due to // IsDeadlineExceeded returns true if the error is due to
// `context.DeadlineExceeded`. // `context.DeadlineExceeded`.
func IsDeadlineExceeded(err error) bool { func IsDeadlineExceeded(err error) bool {
return errors.Cause(err) == context.DeadlineExceeded return errors.Is(err, context.DeadlineExceeded)
} }

View File

@ -64,7 +64,7 @@ func Handlers(handlers ...Handler) HandlerFunc {
for _, handler := range handlers { for _, handler := range handlers {
ch, err := handler.Handle(ctx, desc) ch, err := handler.Handle(ctx, desc)
if err != nil { if err != nil {
if errors.Cause(err) == ErrStopHandler { if errors.Is(err, ErrStopHandler) {
break break
} }
return nil, err return nil, err
@ -87,7 +87,7 @@ func Walk(ctx context.Context, handler Handler, descs ...ocispec.Descriptor) err
children, err := handler.Handle(ctx, desc) children, err := handler.Handle(ctx, desc)
if err != nil { if err != nil {
if errors.Cause(err) == ErrSkipDesc { if errors.Is(err, ErrSkipDesc) {
continue // don't traverse the children. continue // don't traverse the children.
} }
return err return err
@ -136,7 +136,7 @@ func Dispatch(ctx context.Context, handler Handler, limiter *semaphore.Weighted,
limiter.Release(1) limiter.Release(1)
} }
if err != nil { if err != nil {
if errors.Cause(err) == ErrSkipDesc { if errors.Is(err, ErrSkipDesc) {
return nil // don't traverse the children. return nil // don't traverse the children.
} }
return err return err

View File

@ -137,6 +137,8 @@ func checkKillError(err error) error {
strings.Contains(strings.ToLower(err.Error()), "no such process") || strings.Contains(strings.ToLower(err.Error()), "no such process") ||
err == unix.ESRCH { err == unix.ESRCH {
return errors.Wrapf(errdefs.ErrNotFound, "process already finished") return errors.Wrapf(errdefs.ErrNotFound, "process already finished")
} else if strings.Contains(err.Error(), "does not exist") {
return errors.Wrapf(errdefs.ErrNotFound, "no such container")
} }
return errors.Wrapf(err, "unknown error after kill") return errors.Wrapf(err, "unknown error after kill")
} }

View File

@ -44,7 +44,7 @@ var (
// IsSkipPlugin returns true if the error is skipping the plugin // IsSkipPlugin returns true if the error is skipping the plugin
func IsSkipPlugin(err error) bool { func IsSkipPlugin(err error) bool {
return errors.Cause(err) == ErrSkipPlugin return errors.Is(err, ErrSkipPlugin)
} }
// Type is the type of the plugin // Type is the type of the plugin

View File

@ -86,7 +86,7 @@ func (p dockerPusher) Push(ctx context.Context, desc ocispec.Descriptor) (conten
resp, err := req.doWithRetries(ctx, nil) resp, err := req.doWithRetries(ctx, nil)
if err != nil { if err != nil {
if errors.Cause(err) != ErrInvalidAuthorization { if !errors.Is(err, ErrInvalidAuthorization) {
return nil, err return nil, err
} }
log.G(ctx).WithError(err).Debugf("Unable to check existence, continuing with push") log.G(ctx).WithError(err).Debugf("Unable to check existence, continuing with push")

View File

@ -283,7 +283,7 @@ func (r *dockerResolver) Resolve(ctx context.Context, ref string) (string, ocisp
log.G(ctx).Debug("resolving") log.G(ctx).Debug("resolving")
resp, err := req.doWithRetries(ctx, nil) resp, err := req.doWithRetries(ctx, nil)
if err != nil { if err != nil {
if errors.Cause(err) == ErrInvalidAuthorization { if errors.Is(err, ErrInvalidAuthorization) {
err = errors.Wrapf(err, "pull access denied, repository does not exist or may require authorization") err = errors.Wrapf(err, "pull access denied, repository does not exist or may require authorization")
} }
// Store the error for referencing later // Store the error for referencing later

View File

@ -62,7 +62,7 @@ func (p *Process) State(ctx context.Context) (runtime.State, error) {
ID: p.id, ID: p.id,
}) })
if err != nil { if err != nil {
if errors.Cause(err) != ttrpc.ErrClosed { if !errors.Is(err, ttrpc.ErrClosed) {
return runtime.State{}, errdefs.FromGRPC(err) return runtime.State{}, errdefs.FromGRPC(err)
} }

View File

@ -159,7 +159,7 @@ func (t *Task) State(ctx context.Context) (runtime.State, error) {
ID: t.id, ID: t.id,
}) })
if err != nil { if err != nil {
if errors.Cause(err) != ttrpc.ErrClosed { if !errors.Is(err, ttrpc.ErrClosed) {
return runtime.State{}, errdefs.FromGRPC(err) return runtime.State{}, errdefs.FromGRPC(err)
} }
return runtime.State{}, errdefs.ErrNotFound return runtime.State{}, errdefs.ErrNotFound

View File

@ -54,7 +54,7 @@ func (p *process) State(ctx context.Context) (runtime.State, error) {
ExecID: p.id, ExecID: p.id,
}) })
if err != nil { if err != nil {
if errors.Cause(err) != ttrpc.ErrClosed { if !errors.Is(err, ttrpc.ErrClosed) {
return runtime.State{}, errdefs.FromGRPC(err) return runtime.State{}, errdefs.FromGRPC(err)
} }
return runtime.State{}, errdefs.ErrNotFound return runtime.State{}, errdefs.ErrNotFound

View File

@ -94,7 +94,7 @@ func loadShim(ctx context.Context, bundle *Bundle, events *exchange.Exchange, rt
// When using a multi-container shim the 2nd to Nth container in the // When using a multi-container shim the 2nd to Nth container in the
// shim will not have a separate log pipe. Ignore the failure log // shim will not have a separate log pipe. Ignore the failure log
// message here when the shim connect times out. // message here when the shim connect times out.
if !os.IsNotExist(errors.Cause(err)) { if !errors.Is(err, os.ErrNotExist) {
log.G(ctx).WithError(err).Error("copy shim log") log.G(ctx).WithError(err).Error("copy shim log")
} }
} }
@ -191,7 +191,7 @@ func (s *shim) Shutdown(ctx context.Context) error {
_, err := s.task.Shutdown(ctx, &task.ShutdownRequest{ _, err := s.task.Shutdown(ctx, &task.ShutdownRequest{
ID: s.ID(), ID: s.ID(),
}) })
if err != nil && errors.Cause(err) != ttrpc.ErrClosed { if err != nil && !errors.Is(err, ttrpc.ErrClosed) {
return errdefs.FromGRPC(err) return errdefs.FromGRPC(err)
} }
return nil return nil
@ -227,7 +227,7 @@ func (s *shim) Delete(ctx context.Context) (*runtime.Exit, error) {
}) })
if shimErr != nil { if shimErr != nil {
log.G(ctx).WithField("id", s.ID()).WithError(shimErr).Debug("failed to delete task") log.G(ctx).WithField("id", s.ID()).WithError(shimErr).Debug("failed to delete task")
if errors.Cause(shimErr) != ttrpc.ErrClosed { if !errors.Is(shimErr, ttrpc.ErrClosed) {
shimErr = errdefs.FromGRPC(shimErr) shimErr = errdefs.FromGRPC(shimErr)
if !errdefs.IsNotFound(shimErr) { if !errdefs.IsNotFound(shimErr) {
return nil, shimErr return nil, shimErr
@ -444,7 +444,7 @@ func (s *shim) State(ctx context.Context) (runtime.State, error) {
ID: s.ID(), ID: s.ID(),
}) })
if err != nil { if err != nil {
if errors.Cause(err) != ttrpc.ErrClosed { if !errors.Is(err, ttrpc.ErrClosed) {
return runtime.State{}, errdefs.FromGRPC(err) return runtime.State{}, errdefs.FromGRPC(err)
} }
return runtime.State{}, errdefs.ErrNotFound return runtime.State{}, errdefs.ErrNotFound

View File

@ -90,7 +90,7 @@ func checkCopyShimLogError(ctx context.Context, err error) error {
// When using a multi-container shim the 2nd to Nth container in the // When using a multi-container shim the 2nd to Nth container in the
// shim will not have a separate log pipe. Ignore the failure log // shim will not have a separate log pipe. Ignore the failure log
// message here when the shim connect times out. // message here when the shim connect times out.
if os.IsNotExist(errors.Cause(err)) { if errors.Is(err, os.ErrNotExist) {
return nil return nil
} }
return err return err

View File

@ -265,7 +265,7 @@ func (u *unpacker) fetch(ctx context.Context, h images.Handler, layers []ocispec
if u.limiter != nil { if u.limiter != nil {
u.limiter.Release(1) u.limiter.Release(1)
} }
if err != nil && errors.Cause(err) != images.ErrSkipDesc { if err != nil && !errors.Is(err, images.ErrSkipDesc) {
return err return err
} }
close(done[i]) close(done[i])

View File

@ -1,102 +1,101 @@
github.com/beorn7/perks 37c8de3658fcb183f997c4e13e8337516ab753e6 # v1.0.1 github.com/beorn7/perks v1.0.1
github.com/BurntSushi/toml 3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005 # v0.3.1 github.com/BurntSushi/toml v0.3.1
github.com/cespare/xxhash/v2 d7df74196a9e781ede915320c11c378c1b2f3a1f # v2.1.1 github.com/cespare/xxhash/v2 v2.1.1
github.com/containerd/btrfs 153935315f4ab9be5bf03650a1341454b05efa5d github.com/containerd/btrfs 153935315f4ab9be5bf03650a1341454b05efa5d
github.com/containerd/cgroups b4448137398923af7f4918b8b2ad8249172ca7a6 github.com/containerd/cgroups b4448137398923af7f4918b8b2ad8249172ca7a6
github.com/containerd/console 8375c3424e4d7b114e8a90a4a40c8e1b40d1d4e6 # v1.0.0 github.com/containerd/console v1.0.0
github.com/containerd/continuity 0ec596719c75bfd42908850990acea594b7593ac github.com/containerd/continuity d3ef23f19fbb106bb73ffde425d07a9187e30745
github.com/containerd/fifo bda0ff6ed73c67bfb5e62bc9c697f146b7fd7f13 github.com/containerd/fifo f15a3290365b9d2627d189e619ab4008e0069caf
github.com/containerd/go-runc a5c2862aed5e6358b305b0e16bfce58e0549b1cd github.com/containerd/go-runc 7016d3ce2328dd2cb1192b2076ebd565c4e8df0c
github.com/containerd/ttrpc 72bb1b21c5b0a4a107f59dd85f6ab58e564b68d6 # v1.0.1 github.com/containerd/ttrpc v1.0.1
github.com/containerd/typeurl cd3ce7159eae562a4f60ceff37dada11a939d247 # v1.0.1 github.com/containerd/typeurl v1.0.1
github.com/coreos/go-systemd/v22 2d78030078ef61b3cae27f42ad6d0e46db51b339 # v22.0.0 github.com/coreos/go-systemd/v22 v22.0.0
github.com/cpuguy83/go-md2man 7762f7e404f8416dfa1d9bb6a8c192aa9acb4d19 # v1.0.10 github.com/cpuguy83/go-md2man v1.0.10
github.com/docker/go-events e31b211e4f1cd09aa76fe4ac244571fab96ae47f github.com/docker/go-events e31b211e4f1cd09aa76fe4ac244571fab96ae47f
github.com/docker/go-metrics b619b3592b65de4f087d9f16863a7e6ff905973c # v0.0.1 github.com/docker/go-metrics v0.0.1
github.com/docker/go-units 519db1ee28dcc9fd2474ae59fca29a810482bfb1 # v0.4.0 github.com/docker/go-units v0.4.0
github.com/godbus/dbus/v5 37bf87eef99d69c4f1d3528bd66e3a87dc201472 # v5.0.3 github.com/godbus/dbus/v5 v5.0.3
github.com/gogo/googleapis 01e0f9cca9b92166042241267ee2a5cdf5cff46c # v1.3.2 github.com/gogo/googleapis v1.3.2
github.com/gogo/protobuf 5628607bb4c51c3157aacc3a50f0ab707582b805 # v1.3.1 github.com/gogo/protobuf v1.3.1
github.com/golang/protobuf d23c5127dc24889085f8ccea5c9d560a57a879d8 # v1.3.3 github.com/golang/protobuf v1.3.3
github.com/google/go-cmp 3af367b6b30c263d47e8895973edcca9a49cf029 # v0.2.0 github.com/google/go-cmp v0.2.0
github.com/google/uuid 0cd6bf5da1e1c83f8b45653022c74f71af0538a4 # v1.1.1 github.com/google/uuid v1.1.1
github.com/grpc-ecosystem/go-grpc-prometheus c225b8c3b01faf2899099b768856a9e916e5087b # v1.2.0 github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
github.com/hashicorp/errwrap 8a6fb523712970c966eefc6b39ed2c5e74880354 # v1.0.0 github.com/hashicorp/errwrap v1.0.0
github.com/hashicorp/go-multierror 886a7fbe3eb1c874d46f623bfa70af45f425b3d1 # v1.0.0 github.com/hashicorp/go-multierror v1.0.0
github.com/hashicorp/golang-lru 7f827b33c0f158ec5dfbba01bb0b14a4541fd81d # v0.5.3 github.com/hashicorp/golang-lru v0.5.3
github.com/imdario/mergo 7c29201646fa3de8506f701213473dd407f19646 # v0.3.7 github.com/imdario/mergo v0.3.7
github.com/konsorten/go-windows-terminal-sequences edb144dfd453055e1e49a3d8b410a660b5a87613 # v1.0.3 github.com/konsorten/go-windows-terminal-sequences v1.0.3
github.com/matttproud/golang_protobuf_extensions c12348ce28de40eed0136aa2b644d0ee0650e56c # v1.0.1 github.com/matttproud/golang_protobuf_extensions v1.0.1
github.com/Microsoft/go-winio 6c72808b55902eae4c5943626030429ff20f3b63 # v0.4.14 github.com/Microsoft/go-winio v0.4.14
github.com/Microsoft/hcsshim 5bc557dd210ff2caf615e6e22d398123de77fc11 # v0.8.9 github.com/Microsoft/hcsshim v0.8.9
github.com/opencontainers/go-digest c9281466c8b2f606084ac71339773efd177436e7 github.com/opencontainers/go-digest v1.0.0
github.com/opencontainers/image-spec d60099175f88c47cd379c4738d158884749ed235 # v1.0.1 github.com/opencontainers/image-spec v1.0.1
github.com/opencontainers/runc dc9208a3303feef5b3839f4323d9beb36df0a9dd # v1.0.0-rc10 github.com/opencontainers/runc v1.0.0-rc10
github.com/opencontainers/runtime-spec c4ee7d12c742ffe806cd9350b6af3b4b19faed6f # v1.0.2 github.com/opencontainers/runtime-spec v1.0.2
github.com/pkg/errors 614d223910a179a466c1767a985424175c39b465 # v0.9.1 github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang c42bebe5a5cddfc6b28cd639103369d8a75dfa89 # v1.3.0 github.com/prometheus/client_golang v1.3.0
github.com/prometheus/client_model d1d2010b5beead3fa1c5f271a5cf626e40b3ad6e # v0.1.0 github.com/prometheus/client_model v0.1.0
github.com/prometheus/common 287d3e634a1e550c9e463dd7e5a75a422c614505 # v0.7.0 github.com/prometheus/common v0.7.0
github.com/prometheus/procfs 6d489fc7f1d9cd890a250f3ea3431b1744b9623f # v0.0.8 github.com/prometheus/procfs v0.0.8
github.com/russross/blackfriday 05f3235734ad95d0016f6a23902f06461fcf567a # v1.5.2 github.com/russross/blackfriday v1.5.2
github.com/sirupsen/logrus 60c74ad9be0d874af0ab0daef6ab07c5c5911f0d # v1.6.0 github.com/sirupsen/logrus v1.6.0
github.com/syndtr/gocapability d98352740cb2c55f81556b63d4a1ec64c5a319c2 github.com/syndtr/gocapability d98352740cb2c55f81556b63d4a1ec64c5a319c2
github.com/urfave/cli bfe2e925cfb6d44b40ad3a779165ea7e8aff9212 # v1.22.0 github.com/urfave/cli v1.22.0
go.etcd.io/bbolt a0458a2b35708eef59eb5f620ceb3cd1c01a824d # v1.3.3 go.etcd.io/bbolt v1.3.3
go.opencensus.io 9c377598961b706d1542bd2d84d538b5094d596e # v0.22.0 go.opencensus.io v0.22.0
golang.org/x/net f3200d17e092c607f615320ecaad13d87ad9a2b3 golang.org/x/net f3200d17e092c607f615320ecaad13d87ad9a2b3
golang.org/x/sync 42b317875d0fa942474b76e1b46a6060d720ae6e golang.org/x/sync 42b317875d0fa942474b76e1b46a6060d720ae6e
golang.org/x/sys 5c8b2ff67527cb88b770f693cebf3799036d8bc0 golang.org/x/sys 5c8b2ff67527cb88b770f693cebf3799036d8bc0
golang.org/x/text 19e51611da83d6be54ddafce4a4af510cb3e9ea4 golang.org/x/text 19e51611da83d6be54ddafce4a4af510cb3e9ea4
google.golang.org/genproto e50cd9704f63023d62cd06a1994b98227fc4d21a google.golang.org/genproto e50cd9704f63023d62cd06a1994b98227fc4d21a
google.golang.org/grpc f495f5b15ae7ccda3b38c53a1bfcde4c1a58a2bc # v1.27.1 google.golang.org/grpc v1.27.1
gotest.tools/v3 bb0d8a963040ea5048dcef1a14d8f8b58a33d4b3 # v3.0.2 gotest.tools/v3 v3.0.2
# cgroups dependencies # cgroups dependencies
github.com/cilium/ebpf 4032b1d8aae306b7bb94a2a11002932caf88c644 github.com/cilium/ebpf 4032b1d8aae306b7bb94a2a11002932caf88c644
# cri dependencies # cri dependencies
github.com/containerd/cri 65830369b6b2b4edc454bf5cebbd9b76c1c1ac66 # master github.com/containerd/cri 64aa9da76fc0ab333119f455f3b292244c1fae8c # master
github.com/davecgh/go-spew 8991bc29aa16c548c550c7ff78260e27b9ab7c73 # v1.1.1 github.com/davecgh/go-spew v1.1.1
github.com/docker/distribution 0d3efadf0154c2b8a4e7b6621fff9809655cc580
github.com/docker/docker 4634ce647cf2ce2c6031129ccd109e557244986f github.com/docker/docker 4634ce647cf2ce2c6031129ccd109e557244986f
github.com/docker/spdystream 449fdfce4d962303d702fec724ef0ad181c92528 github.com/docker/spdystream 449fdfce4d962303d702fec724ef0ad181c92528
github.com/emicklei/go-restful b993709ae1a4f6dd19cfa475232614441b11c9d5 # v2.9.5 github.com/emicklei/go-restful v2.9.5
github.com/google/gofuzz db92cf7ae75e4a7a28abc005addab2b394362888 # v1.1.0 github.com/google/gofuzz v1.1.0
github.com/json-iterator/go 03217c3e97663914aec3faafde50d081f197a0a2 # v1.1.8 github.com/json-iterator/go v1.1.8
github.com/modern-go/concurrent bacd9c7ef1dd9b15be4a9909b8ac7a4e313eec94 # 1.0.3 github.com/modern-go/concurrent 1.0.3
github.com/modern-go/reflect2 4b7aa43c6742a2c18fdef89dd197aaae7dac7ccd # 1.0.1 github.com/modern-go/reflect2 v1.0.1
github.com/opencontainers/selinux 0d49ba2a6aae052c614dfe5de62a158711a6c461 # 1.5.1 github.com/opencontainers/selinux v1.5.1
github.com/seccomp/libseccomp-golang 689e3c1541a84461afc49c1c87352a6cedf72e9c # v0.9.1 github.com/seccomp/libseccomp-golang v0.9.1
github.com/stretchr/testify 221dbe5ed46703ee255b1da0dec05086f5035f62 # v1.4.0 github.com/stretchr/testify v1.4.0
github.com/tchap/go-patricia 666120de432aea38ab06bd5c818f04f4129882c9 # v2.2.6 github.com/tchap/go-patricia v2.2.6
golang.org/x/crypto bac4c82f69751a6dd76e702d54b3ceb88adab236 golang.org/x/crypto bac4c82f69751a6dd76e702d54b3ceb88adab236
golang.org/x/oauth2 0f29369cfe4552d0e4bcddc57cc75f4d7e672a33 golang.org/x/oauth2 0f29369cfe4552d0e4bcddc57cc75f4d7e672a33
golang.org/x/time 9d24e82272b4f38b78bc8cff74fa936d31ccd8ef golang.org/x/time 9d24e82272b4f38b78bc8cff74fa936d31ccd8ef
gopkg.in/inf.v0 d2d2541c53f18d2a059457998ce2876cc8e67cbf # v0.9.1 gopkg.in/inf.v0 v0.9.1
gopkg.in/yaml.v2 53403b58ad1b561927d19068c655246f2db79d48 # v2.2.8 gopkg.in/yaml.v2 v2.2.8
k8s.io/api d2dce8e1788e4be2be3a62b6439b3eaa087df0df # v0.18.0 k8s.io/api v0.18.2
k8s.io/apimachinery 105e0c6d63f10531ed07f3b5a2195771a0fa444b # v0.18.0 k8s.io/apimachinery v0.18.2
k8s.io/apiserver 5c8e895629a454efd75a453d1dea5b8142db0013 # v0.18.0 k8s.io/apiserver v0.18.2
k8s.io/client-go 0b19784585bd0a0ee5509855829ead81feaa2bdc # v0.18.0 k8s.io/client-go v0.18.2
k8s.io/cri-api 3d1680d8d202aa12c5dc5689170c3c03a488d35b # v0.18.0 k8s.io/cri-api v0.18.2
k8s.io/klog 2ca9ad30301bf30a8a6e0fa2110db6b8df699a91 # v1.0.0 k8s.io/klog v1.0.0
k8s.io/kubernetes 9e991415386e4cf155a24b1da15becaa390438d8 # v1.18.0 k8s.io/kubernetes v1.18.2
k8s.io/utils a9aa75ae1b89e1b992c33383f48e942d97e52dae k8s.io/utils a9aa75ae1b89e1b992c33383f48e942d97e52dae
sigs.k8s.io/structured-merge-diff/v3 877aee05330847a873a1a8998b40e12a1e0fde25 # v3.0.0 sigs.k8s.io/structured-merge-diff/v3 v3.0.0
sigs.k8s.io/yaml 9fc95527decd95bb9d28cc2eab08179b2d0f6971 # v1.2.0 sigs.k8s.io/yaml v1.2.0
# cni dependencies # cni dependencies
github.com/containerd/go-cni 0d360c50b10b350b6bb23863fd4dfb1c232b01c9 github.com/containerd/go-cni 0d360c50b10b350b6bb23863fd4dfb1c232b01c9
github.com/containernetworking/cni 4cfb7b568922a3c79a23e438dc52fe537fc9687e # v0.7.1 github.com/containernetworking/cni v0.7.1
github.com/containernetworking/plugins 9f96827c7cabb03f21d86326000c00f61e181f6a # v0.7.6 github.com/containernetworking/plugins v0.7.6
github.com/fsnotify/fsnotify 4bf2d1fec78374803a39307bfb8d340688f4f28e # v1.4.8 github.com/fsnotify/fsnotify v1.4.8
# image decrypt depedencies # image decrypt depedencies
github.com/containerd/imgcrypt 9e761ccd6069fb707ec9493435f31475b5524b38 # v1.0.1 github.com/containerd/imgcrypt v1.0.1
github.com/containers/ocicrypt 0343cc6053fd65069df55bce6838096e09b4033a # v1.0.1 from containerd/imgcrypt github.com/containers/ocicrypt v1.0.1
github.com/fullsailor/pkcs7 8306686428a5fe132eac8cb7c4848af725098bd4 # from containers/ocicrypt github.com/fullsailor/pkcs7 8306686428a5fe132eac8cb7c4848af725098bd4
gopkg.in/square/go-jose.v2 730df5f748271903322feb182be83b43ebbbe27d # v2.3.1 from containers/ocicrypt gopkg.in/square/go-jose.v2 v2.3.1
# zfs dependencies # zfs dependencies
github.com/containerd/zfs 9abf673ca6ff9ab8d9bd776a4ceff8f6dc699c3d github.com/containerd/zfs 9abf673ca6ff9ab8d9bd776a4ceff8f6dc699c3d

View File

@ -23,7 +23,7 @@ var (
Package = "github.com/containerd/containerd" Package = "github.com/containerd/containerd"
// Version holds the complete version number. Filled in at linking time. // Version holds the complete version number. Filled in at linking time.
Version = "1.3.0+unknown" Version = "1.4.0-beta.0+unknown"
// Revision is filled with the VCS (e.g. git) revision being used to build // Revision is filled with the VCS (e.g. git) revision being used to build
// the program at linking time. // the program at linking time.

View File

@ -138,6 +138,10 @@ func (d *driver) Lstat(p string) (os.FileInfo, error) {
return os.Lstat(p) return os.Lstat(p)
} }
func (d *driver) Readlink(p string) (string, error) {
return os.Readlink(p)
}
func (d *driver) Mkdir(p string, mode os.FileMode) error { func (d *driver) Mkdir(p string, mode os.FileMode) error {
return os.Mkdir(p, mode) return os.Mkdir(p, mode)
} }

View File

@ -131,8 +131,3 @@ func (d *driver) LSetxattr(path string, attrMap map[string][]byte) error {
func (d *driver) DeviceInfo(fi os.FileInfo) (maj uint64, min uint64, err error) { func (d *driver) DeviceInfo(fi os.FileInfo) (maj uint64, min uint64, err error) {
return devices.DeviceInfo(fi) return devices.DeviceInfo(fi)
} }
// Readlink was forked on Windows to fix a Golang bug, use the "os" package here
func (d *driver) Readlink(p string) (string, error) {
return os.Readlink(p)
}

View File

@ -14,12 +14,16 @@
limitations under the License. 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).
package driver package driver
import ( import (
"os" "os"
"github.com/containerd/continuity/sysx"
) )
func (d *driver) Mknod(path string, mode os.FileMode, major, minor int) error { func (d *driver) Mknod(path string, mode os.FileMode, major, minor int) error {
@ -35,9 +39,3 @@ func (d *driver) Lchmod(path string, mode os.FileMode) (err error) {
// TODO: Use Window's equivalent // TODO: Use Window's equivalent
return os.Chmod(path, mode) return os.Chmod(path, mode)
} }
// Readlink is forked in order to support Volume paths which are used
// in container layers.
func (d *driver) Readlink(p string) (string, error) {
return sysx.Readlink(p)
}

View File

@ -1,4 +1,4 @@
// +build solaris darwin freebsd // +build darwin freebsd openbsd solaris
/* /*
Copyright The containerd Authors. Copyright The containerd Authors.

View File

@ -1,3 +1,5 @@
// +build linux openbsd
/* /*
Copyright The containerd Authors. Copyright The containerd Authors.

View File

@ -1,26 +0,0 @@
// +build !windows
/*
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 syscallx
import "syscall"
// Readlink returns the destination of the named symbolic link.
func Readlink(path string, buf []byte) (n int, err error) {
return syscall.Readlink(path, buf)
}

View File

@ -1,112 +0,0 @@
/*
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 syscallx
import (
"syscall"
"unsafe"
)
type reparseDataBuffer struct {
ReparseTag uint32
ReparseDataLength uint16
Reserved uint16
// GenericReparseBuffer
reparseBuffer byte
}
type mountPointReparseBuffer struct {
SubstituteNameOffset uint16
SubstituteNameLength uint16
PrintNameOffset uint16
PrintNameLength uint16
PathBuffer [1]uint16
}
type symbolicLinkReparseBuffer struct {
SubstituteNameOffset uint16
SubstituteNameLength uint16
PrintNameOffset uint16
PrintNameLength uint16
Flags uint32
PathBuffer [1]uint16
}
const (
_IO_REPARSE_TAG_MOUNT_POINT = 0xA0000003
_SYMLINK_FLAG_RELATIVE = 1
)
// Readlink returns the destination of the named symbolic link.
func Readlink(path string, buf []byte) (n int, err error) {
fd, err := syscall.CreateFile(syscall.StringToUTF16Ptr(path), syscall.GENERIC_READ, 0, nil, syscall.OPEN_EXISTING,
syscall.FILE_FLAG_OPEN_REPARSE_POINT|syscall.FILE_FLAG_BACKUP_SEMANTICS, 0)
if err != nil {
return -1, err
}
defer syscall.CloseHandle(fd)
rdbbuf := make([]byte, syscall.MAXIMUM_REPARSE_DATA_BUFFER_SIZE)
var bytesReturned uint32
err = syscall.DeviceIoControl(fd, syscall.FSCTL_GET_REPARSE_POINT, nil, 0, &rdbbuf[0], uint32(len(rdbbuf)), &bytesReturned, nil)
if err != nil {
return -1, err
}
rdb := (*reparseDataBuffer)(unsafe.Pointer(&rdbbuf[0]))
var s string
switch rdb.ReparseTag {
case syscall.IO_REPARSE_TAG_SYMLINK:
data := (*symbolicLinkReparseBuffer)(unsafe.Pointer(&rdb.reparseBuffer))
p := (*[0xffff]uint16)(unsafe.Pointer(&data.PathBuffer[0]))
s = syscall.UTF16ToString(p[data.SubstituteNameOffset/2 : (data.SubstituteNameOffset+data.SubstituteNameLength)/2])
if data.Flags&_SYMLINK_FLAG_RELATIVE == 0 {
if len(s) >= 4 && s[:4] == `\??\` {
s = s[4:]
switch {
case len(s) >= 2 && s[1] == ':': // \??\C:\foo\bar
// do nothing
case len(s) >= 4 && s[:4] == `UNC\`: // \??\UNC\foo\bar
s = `\\` + s[4:]
default:
// unexpected; do nothing
}
} else {
// unexpected; do nothing
}
}
case _IO_REPARSE_TAG_MOUNT_POINT:
data := (*mountPointReparseBuffer)(unsafe.Pointer(&rdb.reparseBuffer))
p := (*[0xffff]uint16)(unsafe.Pointer(&data.PathBuffer[0]))
s = syscall.UTF16ToString(p[data.SubstituteNameOffset/2 : (data.SubstituteNameOffset+data.SubstituteNameLength)/2])
if len(s) >= 4 && s[:4] == `\??\` { // \??\C:\foo\bar
if len(s) < 48 || s[:11] != `\??\Volume{` {
s = s[4:]
}
} else {
// unexpected; do nothing
}
default:
// the path is not a symlink or junction but another type of reparse
// point
return -1, syscall.ENOENT
}
n = copy(buf, []byte(s))
return n, nil
}

View File

@ -1,128 +0,0 @@
/*
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 sysx
import (
"os"
"path/filepath"
"github.com/containerd/continuity/syscallx"
)
// Readlink returns the destination of the named symbolic link.
// If there is an error, it will be of type *PathError.
func Readlink(name string) (string, error) {
for len := 128; ; len *= 2 {
b := make([]byte, len)
n, e := fixCount(syscallx.Readlink(fixLongPath(name), b))
if e != nil {
return "", &os.PathError{Op: "readlink", Path: name, Err: e}
}
if n < len {
return string(b[0:n]), nil
}
}
}
// Many functions in package syscall return a count of -1 instead of 0.
// Using fixCount(call()) instead of call() corrects the count.
func fixCount(n int, err error) (int, error) {
if n < 0 {
n = 0
}
return n, err
}
// fixLongPath returns the extended-length (\\?\-prefixed) form of
// path when needed, in order to avoid the default 260 character file
// path limit imposed by Windows. If path is not easily converted to
// the extended-length form (for example, if path is a relative path
// or contains .. elements), or is short enough, fixLongPath returns
// path unmodified.
//
// See https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx#maxpath
func fixLongPath(path string) string {
// Do nothing (and don't allocate) if the path is "short".
// Empirically (at least on the Windows Server 2013 builder),
// the kernel is arbitrarily okay with < 248 bytes. That
// matches what the docs above say:
// "When using an API to create a directory, the specified
// path cannot be so long that you cannot append an 8.3 file
// name (that is, the directory name cannot exceed MAX_PATH
// minus 12)." Since MAX_PATH is 260, 260 - 12 = 248.
//
// The MSDN docs appear to say that a normal path that is 248 bytes long
// will work; empirically the path must be less then 248 bytes long.
if len(path) < 248 {
// Don't fix. (This is how Go 1.7 and earlier worked,
// not automatically generating the \\?\ form)
return path
}
// The extended form begins with \\?\, as in
// \\?\c:\windows\foo.txt or \\?\UNC\server\share\foo.txt.
// The extended form disables evaluation of . and .. path
// elements and disables the interpretation of / as equivalent
// to \. The conversion here rewrites / to \ and elides
// . elements as well as trailing or duplicate separators. For
// simplicity it avoids the conversion entirely for relative
// paths or paths containing .. elements. For now,
// \\server\share paths are not converted to
// \\?\UNC\server\share paths because the rules for doing so
// are less well-specified.
if len(path) >= 2 && path[:2] == `\\` {
// Don't canonicalize UNC paths.
return path
}
if !filepath.IsAbs(path) {
// Relative path
return path
}
const prefix = `\\?`
pathbuf := make([]byte, len(prefix)+len(path)+len(`\`))
copy(pathbuf, prefix)
n := len(path)
r, w := 0, len(prefix)
for r < n {
switch {
case os.IsPathSeparator(path[r]):
// empty block
r++
case path[r] == '.' && (r+1 == n || os.IsPathSeparator(path[r+1])):
// /./
r++
case r+1 < n && path[r] == '.' && path[r+1] == '.' && (r+2 == n || os.IsPathSeparator(path[r+2])):
// /../ is currently unhandled
return path
default:
pathbuf[w] = '\\'
w++
for ; r < n && !os.IsPathSeparator(path[r]); r++ {
pathbuf[w] = path[r]
w++
}
}
}
// A drive's root directory needs a trailing \
if w == len(`\\?\c:`) {
pathbuf[w] = '\\'
w++
}
return string(pathbuf[:w])
}

View File

@ -1,4 +1,4 @@
// +build darwin freebsd // +build darwin freebsd openbsd
/* /*
Copyright The containerd Authors. Copyright The containerd Authors.

View File

@ -20,7 +20,6 @@ package sysx
import ( import (
"bytes" "bytes"
"syscall"
"golang.org/x/sys/unix" "golang.org/x/sys/unix"
) )
@ -66,60 +65,53 @@ func LGetxattr(path, attr string) ([]byte, error) {
return getxattrAll(path, attr, unix.Lgetxattr) return getxattrAll(path, attr, unix.Lgetxattr)
} }
const defaultXattrBufferSize = 5 const defaultXattrBufferSize = 128
type listxattrFunc func(path string, dest []byte) (int, error) type listxattrFunc func(path string, dest []byte) (int, error)
func listxattrAll(path string, listFunc listxattrFunc) ([]string, error) { func listxattrAll(path string, listFunc listxattrFunc) ([]string, error) {
var p []byte // nil on first execution buf := make([]byte, defaultXattrBufferSize)
n, err := listFunc(path, buf)
for { for err == unix.ERANGE {
n, err := listFunc(path, p) // first call gets buffer size. // Buffer too small, use zero-sized buffer to get the actual size
n, err = listFunc(path, []byte{})
if err != nil { if err != nil {
return nil, err return nil, err
} }
buf = make([]byte, n)
if n > len(p) { n, err = listFunc(path, buf)
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)
}
}
return entries, nil
} }
if err != nil {
return nil, err
}
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
} }
type getxattrFunc func(string, string, []byte) (int, error) type getxattrFunc func(string, string, []byte) (int, error)
func getxattrAll(path, attr string, getFunc getxattrFunc) ([]byte, error) { func getxattrAll(path, attr string, getFunc getxattrFunc) ([]byte, error) {
p := make([]byte, defaultXattrBufferSize) buf := make([]byte, defaultXattrBufferSize)
for { n, err := getFunc(path, attr, buf)
n, err := getFunc(path, attr, p) 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 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 return nil, err
} }
buf = make([]byte, n)
// realloc to correct size and repeat n, err = getFunc(path, attr, buf)
if n > len(p) {
p = make([]byte, n)
continue
}
return p[:n], nil
} }
if err != nil {
return nil, err
}
return buf[:n], nil
} }

View File

@ -21,10 +21,10 @@ import (
) )
var ( var (
ErrClosed = errors.New("fifo closed") ErrClosed = errors.New("fifo closed")
ErrCtrlClosed = errors.New("control of closed fifo") ErrCtrlClosed = errors.New("control of closed fifo")
ErrRdFrmWRONLY = errors.New("reading from write-only fifo") ErrRdFrmWRONLY = errors.New("reading from write-only fifo")
ErrReadClosed = errors.New("reading from a closed fifo") ErrReadClosed = errors.New("reading from a closed fifo")
ErrWrToRDONLY = errors.New("writing to read-only fifo") ErrWrToRDONLY = errors.New("writing to read-only fifo")
ErrWriteClosed = errors.New("writing to a closed fifo") ErrWriteClosed = errors.New("writing to a closed fifo")
) )

View File

@ -17,6 +17,7 @@
package fifo package fifo
import ( import (
"context"
"io" "io"
"os" "os"
"runtime" "runtime"
@ -24,7 +25,6 @@ import (
"syscall" "syscall"
"github.com/pkg/errors" "github.com/pkg/errors"
"golang.org/x/net/context"
) )
type fifo struct { type fifo struct {

9
vendor/github.com/containerd/fifo/go.mod generated vendored Normal file
View File

@ -0,0 +1,9 @@
module github.com/containerd/fifo
go 1.13
require (
github.com/pkg/errors v0.8.1
github.com/stretchr/testify v1.4.0
golang.org/x/sys v0.0.0-20191210023423-ac6580df4449
)

View File

@ -27,6 +27,7 @@ import (
"github.com/pkg/errors" "github.com/pkg/errors"
) )
//nolint:golint
const O_PATH = 010000000 const O_PATH = 010000000
type handle struct { type handle struct {
@ -56,9 +57,10 @@ func getHandle(fn string) (*handle, error) {
h := &handle{ h := &handle{
f: f, f: f,
name: fn, name: fn,
dev: uint64(stat.Dev), //nolint:unconvert
ino: stat.Ino, dev: uint64(stat.Dev),
fd: fd, ino: stat.Ino,
fd: fd,
} }
// check /proc just in case // check /proc just in case
@ -83,6 +85,7 @@ func (h *handle) Path() (string, error) {
if err := syscall.Stat(h.procPath(), &stat); err != nil { if err := syscall.Stat(h.procPath(), &stat); err != nil {
return "", errors.Wrapf(err, "path %v could not be statted", h.procPath()) return "", errors.Wrapf(err, "path %v could not be statted", h.procPath())
} }
//nolint:unconvert
if uint64(stat.Dev) != h.dev || stat.Ino != h.ino { if uint64(stat.Dev) != h.dev || stat.Ino != h.ino {
return "", errors.Errorf("failed to verify handle %v/%v %v/%v", stat.Dev, h.dev, stat.Ino, h.ino) return "", errors.Errorf("failed to verify handle %v/%v %v/%v", stat.Dev, h.dev, stat.Ino, h.ino)
} }

View File

@ -23,7 +23,7 @@ import (
) )
// SyscallConn provides raw access to the fifo's underlying filedescrptor. // SyscallConn provides raw access to the fifo's underlying filedescrptor.
// See syscall.Conn for guarentees provided by this interface. // See syscall.Conn for guarantees provided by this interface.
func (f *fifo) SyscallConn() (syscall.RawConn, error) { func (f *fifo) SyscallConn() (syscall.RawConn, error) {
// deterministic check for closed // deterministic check for closed
select { select {

10
vendor/github.com/containerd/go-runc/go.mod generated vendored Normal file
View File

@ -0,0 +1,10 @@
module github.com/containerd/go-runc
go 1.13
require (
github.com/containerd/console v0.0.0-20191206165004-02ecf6a7291e
github.com/opencontainers/runtime-spec v1.0.1
github.com/pkg/errors v0.8.1
golang.org/x/sys v0.0.0-20191210023423-ac6580df4449
)

View File

@ -623,32 +623,22 @@ func (r *Runc) Version(context context.Context) (Version, error) {
func parseVersion(data []byte) (Version, error) { func parseVersion(data []byte) (Version, error) {
var v Version var v Version
parts := strings.Split(strings.TrimSpace(string(data)), "\n") parts := strings.Split(strings.TrimSpace(string(data)), "\n")
if len(parts) != 3 {
return v, nil if len(parts) > 0 {
} if !strings.HasPrefix(parts[0], "runc version ") {
for i, p := range []struct { return v, nil
dest *string }
split string v.Runc = parts[0][13:]
}{
{ for _, part := range parts[1:] {
dest: &v.Runc, if strings.HasPrefix(part, "commit: ") {
split: "version ", v.Commit = part[8:]
}, } else if strings.HasPrefix(part, "spec: ") {
{ v.Spec = part[6:]
dest: &v.Commit, }
split: ": ",
},
{
dest: &v.Spec,
split: ": ",
},
} {
p2 := strings.Split(parts[i], p.split)
if len(p2) != 2 {
return v, fmt.Errorf("unable to parse version line %q", parts[i])
} }
*p.dest = p2[1]
} }
return v, nil return v, nil
} }

View File

@ -4,6 +4,7 @@ import (
"reflect" "reflect"
"runtime" "runtime"
"strings" "strings"
"sync"
"unsafe" "unsafe"
) )
@ -15,10 +16,17 @@ func typelinks1() [][]unsafe.Pointer
//go:linkname typelinks2 reflect.typelinks //go:linkname typelinks2 reflect.typelinks
func typelinks2() (sections []unsafe.Pointer, offset [][]int32) func typelinks2() (sections []unsafe.Pointer, offset [][]int32)
var types = map[string]reflect.Type{} // initOnce guards initialization of types and packages
var packages = map[string]map[string]reflect.Type{} var initOnce sync.Once
var types map[string]reflect.Type
var packages map[string]map[string]reflect.Type
// discoverTypes initializes types and packages
func discoverTypes() {
types = make(map[string]reflect.Type)
packages = make(map[string]map[string]reflect.Type)
func init() {
ver := runtime.Version() ver := runtime.Version()
if ver == "go1.5" || strings.HasPrefix(ver, "go1.5.") { if ver == "go1.5" || strings.HasPrefix(ver, "go1.5.") {
loadGo15Types() loadGo15Types()
@ -90,11 +98,13 @@ type emptyInterface struct {
// TypeByName return the type by its name, just like Class.forName in java // TypeByName return the type by its name, just like Class.forName in java
func TypeByName(typeName string) Type { func TypeByName(typeName string) Type {
initOnce.Do(discoverTypes)
return Type2(types[typeName]) return Type2(types[typeName])
} }
// TypeByPackageName return the type by its package and name // TypeByPackageName return the type by its package and name
func TypeByPackageName(pkgPath string, name string) Type { func TypeByPackageName(pkgPath string, name string) Type {
initOnce.Do(discoverTypes)
pkgTypes := packages[pkgPath] pkgTypes := packages[pkgPath]
if pkgTypes == nil { if pkgTypes == nil {
return nil return nil