Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release/1.7 backport] switch back from golang.org/x/sys/execabs to os/exec (go1.19) #9602

Merged
merged 2 commits into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion archive/compression/compression.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ import (
"fmt"
"io"
"os"
"os/exec"
"strconv"
"sync"

"github.com/containerd/containerd/log"
"github.com/klauspost/compress/zstd"
exec "golang.org/x/sys/execabs"
)

type (
Expand Down
3 changes: 1 addition & 2 deletions archive/compression/compression_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,11 @@ import (
"crypto/rand"
"io"
"os"
"os/exec"
"path/filepath"
"runtime"
"strings"
"testing"

exec "golang.org/x/sys/execabs"
)

func TestMain(m *testing.M) {
Expand Down
2 changes: 1 addition & 1 deletion archive/tar_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"fmt"
"io"
"os"
"os/exec"
"path/filepath"
"runtime"
"testing"
Expand All @@ -38,7 +39,6 @@ import (
"github.com/containerd/continuity/fs/fstest"
"github.com/opencontainers/go-digest"
"github.com/stretchr/testify/require"
exec "golang.org/x/sys/execabs"
)

const tarCmd = "tar"
Expand Down
2 changes: 1 addition & 1 deletion cmd/containerd-shim/main_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"io"
"net"
"os"
"os/exec"
"os/signal"
"runtime"
"runtime/debug"
Expand All @@ -48,7 +49,6 @@ import (
"github.com/containerd/containerd/version"
"github.com/containerd/ttrpc"
"github.com/sirupsen/logrus"
exec "golang.org/x/sys/execabs"
"golang.org/x/sys/unix"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/containerd/command/service_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ import (
"fmt"
"log"
"os"
"os/exec"
"path/filepath"
"time"

"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/services/server"
"github.com/sirupsen/logrus"
"github.com/urfave/cli"
exec "golang.org/x/sys/execabs"
"golang.org/x/sys/windows"
"golang.org/x/sys/windows/svc"
"golang.org/x/sys/windows/svc/debug"
Expand Down
2 changes: 1 addition & 1 deletion cmd/ctr/commands/content/content.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"fmt"
"io"
"os"
"os/exec"
"sort"
"strings"
"text/tabwriter"
Expand All @@ -35,7 +36,6 @@ import (
digest "github.com/opencontainers/go-digest"
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/urfave/cli"
exec "golang.org/x/sys/execabs"
)

var (
Expand Down
3 changes: 1 addition & 2 deletions contrib/apparmor/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,10 @@ import (
"fmt"
"io"
"os"
"os/exec"
"path"
"strings"
"text/template"

exec "golang.org/x/sys/execabs"
)

// NOTE: This code is copied from <github.com/docker/docker/profiles/apparmor>.
Expand Down
2 changes: 1 addition & 1 deletion contrib/nvidia/nvidia.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ import (
"context"
"fmt"
"os"
"os/exec"
"strconv"
"strings"

"github.com/containerd/containerd/containers"
"github.com/containerd/containerd/oci"
specs "github.com/opencontainers/runtime-spec/specs-go"
exec "golang.org/x/sys/execabs"
)

// NvidiaCLI is the path to the Nvidia helper binary
Expand Down
2 changes: 1 addition & 1 deletion diff/stream_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ import (
"fmt"
"io"
"os"
"os/exec"
"sync"

"github.com/containerd/containerd/protobuf"
"github.com/containerd/containerd/protobuf/proto"
"github.com/containerd/typeurl/v2"
exec "golang.org/x/sys/execabs"
)

// NewBinaryProcessor returns a binary processor for use with processing content streams
Expand Down
2 changes: 1 addition & 1 deletion diff/stream_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"fmt"
"io"
"os"
"os/exec"
"path/filepath"
"sync"

Expand All @@ -31,7 +32,6 @@ import (
"github.com/containerd/containerd/protobuf/proto"
"github.com/containerd/typeurl/v2"
"github.com/sirupsen/logrus"
exec "golang.org/x/sys/execabs"
)

const processorPipe = "STREAM_PROCESSOR_PIPE"
Expand Down
2 changes: 1 addition & 1 deletion integration/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ import (
"fmt"
"io"
"os"
"os/exec"
"testing"
"time"

"github.com/opencontainers/go-digest"
"github.com/opencontainers/image-spec/identity"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/otel"
exec "golang.org/x/sys/execabs"

. "github.com/containerd/containerd"
"github.com/containerd/containerd/defaults"
Expand Down
2 changes: 1 addition & 1 deletion integration/client/container_fuzzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ import (
"io"
"net/http"
"os"
"os/exec"
"strings"
"time"

fuzz "github.com/AdaLogics/go-fuzz-headers"
"github.com/containerd/containerd"
"github.com/containerd/containerd/oci"
exec "golang.org/x/sys/execabs"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion integration/client/container_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"fmt"
"io"
"os"
"os/exec"
"path/filepath"
"runtime"
"strings"
Expand All @@ -45,7 +46,6 @@ import (

"github.com/opencontainers/runtime-spec/specs-go"
"github.com/stretchr/testify/require"
exec "golang.org/x/sys/execabs"
"golang.org/x/sys/unix"
)

Expand Down
2 changes: 1 addition & 1 deletion integration/client/container_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"fmt"
"io"
"os"
"os/exec"
"path"
"path/filepath"
"runtime"
Expand Down Expand Up @@ -49,7 +50,6 @@ import (
"github.com/containerd/typeurl/v2"
specs "github.com/opencontainers/runtime-spec/specs-go"
"github.com/stretchr/testify/require"
exec "golang.org/x/sys/execabs"
)

func empty() cio.Creator {
Expand Down
2 changes: 1 addition & 1 deletion integration/client/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ import (
"errors"
"fmt"
"io"
"os/exec"
"runtime"
"sync"
"syscall"
"time"

. "github.com/containerd/containerd"
exec "golang.org/x/sys/execabs"
)

type daemon struct {
Expand Down
2 changes: 1 addition & 1 deletion integration/client/restart_monitor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"errors"
"fmt"
"os"
"os/exec"
"path/filepath"
"runtime"
"strconv"
Expand All @@ -37,7 +38,6 @@ import (
"github.com/containerd/containerd/runtime/restart"
srvconfig "github.com/containerd/containerd/services/server/config"
"github.com/containerd/typeurl/v2"
exec "golang.org/x/sys/execabs"
)

//nolint:unused // Ignore on non-Linux
Expand Down
2 changes: 1 addition & 1 deletion integration/image_load_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
package integration

import (
"os/exec"
"path/filepath"
"testing"
"time"

"github.com/containerd/containerd/integration/images"
"github.com/stretchr/testify/require"
exec "golang.org/x/sys/execabs"
runtime "k8s.io/cri-api/pkg/apis/runtime/v1"
)

Expand Down
2 changes: 1 addition & 1 deletion integration/issue7496_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"io"
"net"
"os"
"os/exec"
"strconv"
"strings"
"syscall"
Expand All @@ -36,7 +37,6 @@ import (
"github.com/containerd/ttrpc"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
exec "golang.org/x/sys/execabs"
)

// TestIssue7496 is used to reproduce https://github.com/containerd/containerd/issues/7496
Expand Down
2 changes: 1 addition & 1 deletion integration/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"fmt"
"io"
"os"
"os/exec"
"path/filepath"
goruntime "runtime"
"strconv"
Expand All @@ -47,7 +48,6 @@ import (
"github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
exec "golang.org/x/sys/execabs"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
runtime "k8s.io/cri-api/pkg/apis/runtime/v1"
Expand Down
2 changes: 1 addition & 1 deletion integration/pod_userns_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package integration
import (
"fmt"
"os"
"os/exec"
"path/filepath"
"syscall"
"testing"
Expand All @@ -27,7 +28,6 @@ import (
"github.com/containerd/containerd/integration/images"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
exec "golang.org/x/sys/execabs"
runtime "k8s.io/cri-api/pkg/apis/runtime/v1"
)

Expand Down
3 changes: 1 addition & 2 deletions integration/volume_copy_up_unix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ package integration

import (
"fmt"

exec "golang.org/x/sys/execabs"
"os/exec"
)

func getOwnership(path string) (string, error) {
Expand Down
2 changes: 1 addition & 1 deletion mount/lookup_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package mount
import (
"fmt"
"os"
"os/exec"
"path/filepath"
"strings"
"testing"
Expand All @@ -28,7 +29,6 @@ import (
"github.com/containerd/continuity/testutil"
"github.com/containerd/continuity/testutil/loopback"
"github.com/stretchr/testify/assert"
exec "golang.org/x/sys/execabs"
)

func checkLookup(t *testing.T, fsType, mntPoint, dir string) {
Expand Down
2 changes: 1 addition & 1 deletion mount/mount_freebsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import (
"errors"
"fmt"
"os"
"os/exec"
"time"

exec "golang.org/x/sys/execabs"
"golang.org/x/sys/unix"
)

Expand Down
2 changes: 1 addition & 1 deletion mount/mount_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ import (
"errors"
"fmt"
"os"
"os/exec"
"path"
"runtime"
"strings"
"time"

exec "golang.org/x/sys/execabs"
"golang.org/x/sys/unix"
)

Expand Down
2 changes: 1 addition & 1 deletion mount/mount_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ package mount
import (
"fmt"
"os"
"os/exec"
"path/filepath"
"reflect"
"testing"

"github.com/containerd/continuity/testutil"
exec "golang.org/x/sys/execabs"
"golang.org/x/sys/unix"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/process/io.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"io"
"net/url"
"os"
"os/exec"
"path/filepath"
"sync"
"sync/atomic"
Expand All @@ -36,7 +37,6 @@ import (
"github.com/containerd/fifo"
runc "github.com/containerd/go-runc"
"github.com/hashicorp/go-multierror"
exec "golang.org/x/sys/execabs"
)

const binaryIOProcTermTimeout = 12 * time.Second // Give logger process solid 10 seconds for cleanup
Expand Down
3 changes: 1 addition & 2 deletions pkg/process/io_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ package process
import (
"net/url"
"os"

exec "golang.org/x/sys/execabs"
"os/exec"
)

// NewBinaryCmd returns a Cmd to be used to start a logging binary.
Expand Down