diff --git a/container.go b/container.go index 8384a481f..d5da55e51 100644 --- a/container.go +++ b/container.go @@ -32,7 +32,7 @@ import ( "github.com/containerd/containerd/images" "github.com/containerd/containerd/oci" "github.com/containerd/containerd/runtime/v2/runc/options" - "github.com/containerd/containerd/sys" + "github.com/containerd/fifo" "github.com/containerd/typeurl" prototypes "github.com/gogo/protobuf/types" ver "github.com/opencontainers/image-spec/specs-go" @@ -435,12 +435,12 @@ func loadFifos(response *tasks.GetResponse) *cio.FIFOSet { err error dirs = map[string]struct{}{} ) - for _, fifo := range fifos { - if isFifo, _ := sys.IsFifo(fifo); isFifo { - if rerr := os.Remove(fifo); err == nil { + for _, f := range fifos { + if isFifo, _ := fifo.IsFifo(f); isFifo { + if rerr := os.Remove(f); err == nil { err = rerr } - dirs[filepath.Dir(fifo)] = struct{}{} + dirs[filepath.Dir(f)] = struct{}{} } } for dir := range dirs { diff --git a/go.mod b/go.mod index e115c61b9..f232e3b94 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/containerd/cgroups v0.0.0-20210114181951-8a68de567b68 github.com/containerd/console v1.0.2 github.com/containerd/continuity v0.0.0-20210208174643-50096c924a4e - github.com/containerd/fifo v0.0.0-20210316144830-115abcc95a1d + github.com/containerd/fifo v1.0.0 github.com/containerd/go-cni v1.0.2 github.com/containerd/go-runc v0.0.0-20201020171139-16b287bc67d0 github.com/containerd/imgcrypt v1.1.1 diff --git a/go.sum b/go.sum index cb98ee090..c72782cf3 100644 --- a/go.sum +++ b/go.sum @@ -136,8 +136,9 @@ github.com/containerd/fifo v0.0.0-20180307165137-3d5202aec260/go.mod h1:ODA38xgv 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= github.com/containerd/fifo v0.0.0-20201026212402-0724c46b320c/go.mod h1:jPQ2IAeZRCYxpS/Cm1495vGFww6ecHmMk1YJH2Q5ln0= -github.com/containerd/fifo v0.0.0-20210316144830-115abcc95a1d h1:u6sWqdNGAy7+O8qG/r1dqdnZE7IdEjteK3WGuvbfreo= github.com/containerd/fifo v0.0.0-20210316144830-115abcc95a1d/go.mod h1:ocF/ME1SX5b1AOlWi9r677YJmCPSwwWnQ9O123vzpE4= +github.com/containerd/fifo v1.0.0 h1:6PirWBr9/L7GDamKr+XM0IeUFXu5mf3M/BPpH9gaLBU= +github.com/containerd/fifo v1.0.0/go.mod h1:ocF/ME1SX5b1AOlWi9r677YJmCPSwwWnQ9O123vzpE4= github.com/containerd/go-cni v1.0.1/go.mod h1:+vUpYxKvAF72G9i1WoDOiPGRtQpqsNW/ZHtSlv++smU= github.com/containerd/go-cni v1.0.2 h1:YbJAhpTevL2v6u8JC1NhCYRwf+3Vzxcc5vGnYoJ7VeE= github.com/containerd/go-cni v1.0.2/go.mod h1:nrNABBHzu0ZwCug9Ije8hL2xBCYh/pjfMb1aZGrrohk= diff --git a/integration/client/go.sum b/integration/client/go.sum index 0d00f5ce7..6432aade0 100644 --- a/integration/client/go.sum +++ b/integration/client/go.sum @@ -80,8 +80,8 @@ github.com/containerd/console v1.0.2 h1:Pi6D+aZXM+oUw1czuKgH5IJ+y0jhYcwBJfx5/Ghn github.com/containerd/console v1.0.2/go.mod h1:ytZPjGgY2oeTkAONYafi2kSj0aYggsf8acV1PGKCbzQ= github.com/containerd/continuity v0.0.0-20210208174643-50096c924a4e h1:6JKvHHt396/qabvMhnhUZvWaHZzfVfldxE60TK8YLhg= github.com/containerd/continuity v0.0.0-20210208174643-50096c924a4e/go.mod h1:EXlVlkqNba9rJe3j7w3Xa924itAMLgZH4UD/Q4PExuQ= -github.com/containerd/fifo v0.0.0-20210316144830-115abcc95a1d h1:u6sWqdNGAy7+O8qG/r1dqdnZE7IdEjteK3WGuvbfreo= -github.com/containerd/fifo v0.0.0-20210316144830-115abcc95a1d/go.mod h1:ocF/ME1SX5b1AOlWi9r677YJmCPSwwWnQ9O123vzpE4= +github.com/containerd/fifo v1.0.0 h1:6PirWBr9/L7GDamKr+XM0IeUFXu5mf3M/BPpH9gaLBU= +github.com/containerd/fifo v1.0.0/go.mod h1:ocF/ME1SX5b1AOlWi9r677YJmCPSwwWnQ9O123vzpE4= github.com/containerd/go-cni v1.0.2/go.mod h1:nrNABBHzu0ZwCug9Ije8hL2xBCYh/pjfMb1aZGrrohk= github.com/containerd/go-runc v0.0.0-20200220073739-7016d3ce2328/go.mod h1:PpyHrqVs8FTi9vpyHwPwiNEGaACDxT/N/pLcvMSRA9g= github.com/containerd/go-runc v0.0.0-20201020171139-16b287bc67d0 h1:e+50zk22gvHLJKe8+d+xSMyA88PPQk/XfWuUw1BdnPA= diff --git a/pkg/process/io.go b/pkg/process/io.go index 40172a70e..de0bcc395 100644 --- a/pkg/process/io.go +++ b/pkg/process/io.go @@ -34,7 +34,6 @@ import ( "github.com/containerd/containerd/log" "github.com/containerd/containerd/namespaces" "github.com/containerd/containerd/pkg/stdio" - "github.com/containerd/containerd/sys" "github.com/containerd/fifo" runc "github.com/containerd/go-runc" "github.com/hashicorp/go-multierror" @@ -179,7 +178,7 @@ func copyPipes(ctx context.Context, rio runc.IO, stdin, stdout, stderr string, w }, }, } { - ok, err := sys.IsFifo(i.name) + ok, err := fifo.IsFifo(i.name) if err != nil { return err } diff --git a/vendor/github.com/containerd/fifo/.gitattributes b/vendor/github.com/containerd/fifo/.gitattributes new file mode 100644 index 000000000..d207b1802 --- /dev/null +++ b/vendor/github.com/containerd/fifo/.gitattributes @@ -0,0 +1 @@ +*.go text eol=lf diff --git a/vendor/github.com/containerd/fifo/errors.go b/vendor/github.com/containerd/fifo/errors.go index 9582096cb..50f73b2dc 100644 --- a/vendor/github.com/containerd/fifo/errors.go +++ b/vendor/github.com/containerd/fifo/errors.go @@ -16,9 +16,7 @@ package fifo -import ( - "errors" -) +import "errors" var ( ErrClosed = errors.New("fifo closed") diff --git a/vendor/github.com/containerd/fifo/fifo.go b/vendor/github.com/containerd/fifo/fifo.go index 96c214f27..45a9b3840 100644 --- a/vendor/github.com/containerd/fifo/fifo.go +++ b/vendor/github.com/containerd/fifo/fifo.go @@ -1,3 +1,5 @@ +// +build !windows + /* Copyright The containerd Authors. @@ -74,7 +76,7 @@ func OpenFifo(ctx context.Context, fn string, flag int, perm os.FileMode) (io.Re func openFifo(ctx context.Context, fn string, flag int, perm os.FileMode) (*fifo, error) { if _, err := os.Stat(fn); err != nil { if os.IsNotExist(err) && flag&syscall.O_CREAT != 0 { - if err := mkfifo(fn, uint32(perm&os.ModePerm)); err != nil && !os.IsExist(err) { + if err := syscall.Mkfifo(fn, uint32(perm&os.ModePerm)); err != nil && !os.IsExist(err) { return nil, errors.Wrapf(err, "error creating fifo %v", fn) } } else { diff --git a/vendor/github.com/containerd/fifo/handle_nolinux.go b/vendor/github.com/containerd/fifo/handle_nolinux.go index 4f2a282b2..81ca308fe 100644 --- a/vendor/github.com/containerd/fifo/handle_nolinux.go +++ b/vendor/github.com/containerd/fifo/handle_nolinux.go @@ -1,4 +1,4 @@ -// +build !linux +// +build !linux,!windows /* Copyright The containerd Authors. @@ -38,8 +38,8 @@ func getHandle(fn string) (*handle, error) { h := &handle{ fn: fn, - dev: uint64(stat.Dev), - ino: uint64(stat.Ino), + dev: uint64(stat.Dev), //nolint: unconvert + ino: uint64(stat.Ino), //nolint: unconvert } return h, nil @@ -50,7 +50,7 @@ func (h *handle) Path() (string, error) { if err := syscall.Stat(h.fn, &stat); err != nil { return "", errors.Wrapf(err, "path %v could not be statted", h.fn) } - if uint64(stat.Dev) != h.dev || uint64(stat.Ino) != h.ino { + if uint64(stat.Dev) != h.dev || uint64(stat.Ino) != h.ino { //nolint: unconvert return "", errors.Errorf("failed to verify handle %v/%v %v/%v for %v", stat.Dev, h.dev, stat.Ino, h.ino, h.fn) } return h.fn, nil diff --git a/vendor/github.com/containerd/fifo/mkfifo_nosolaris.go b/vendor/github.com/containerd/fifo/mkfifo_nosolaris.go deleted file mode 100644 index 2799a06d1..000000000 --- a/vendor/github.com/containerd/fifo/mkfifo_nosolaris.go +++ /dev/null @@ -1,25 +0,0 @@ -// +build !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 fifo - -import "syscall" - -func mkfifo(path string, mode uint32) (err error) { - return syscall.Mkfifo(path, mode) -} diff --git a/vendor/github.com/containerd/fifo/mkfifo_solaris.go b/vendor/github.com/containerd/fifo/mkfifo_solaris.go deleted file mode 100644 index 1ecd722ae..000000000 --- a/vendor/github.com/containerd/fifo/mkfifo_solaris.go +++ /dev/null @@ -1,27 +0,0 @@ -// +build 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 fifo - -import ( - "golang.org/x/sys/unix" -) - -func mkfifo(path string, mode uint32) (err error) { - return unix.Mkfifo(path, mode) -} diff --git a/vendor/github.com/containerd/fifo/raw.go b/vendor/github.com/containerd/fifo/raw.go index 3b78a49c7..cead94ca2 100644 --- a/vendor/github.com/containerd/fifo/raw.go +++ b/vendor/github.com/containerd/fifo/raw.go @@ -1,4 +1,4 @@ -// +build go1.12 +// +build !windows /* Copyright The containerd Authors. diff --git a/sys/filesys.go b/vendor/github.com/containerd/fifo/utils.go similarity index 98% rename from sys/filesys.go rename to vendor/github.com/containerd/fifo/utils.go index 825d21d19..bbdf79015 100644 --- a/sys/filesys.go +++ b/vendor/github.com/containerd/fifo/utils.go @@ -14,7 +14,7 @@ limitations under the License. */ -package sys +package fifo import "os" diff --git a/vendor/modules.txt b/vendor/modules.txt index 9f5c437f5..5ace8a3e3 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -79,7 +79,7 @@ github.com/containerd/continuity/proto github.com/containerd/continuity/sysx github.com/containerd/continuity/testutil github.com/containerd/continuity/testutil/loopback -# github.com/containerd/fifo v0.0.0-20210316144830-115abcc95a1d +# github.com/containerd/fifo v1.0.0 ## explicit github.com/containerd/fifo # github.com/containerd/go-cni v1.0.2