From 8b85274d265815a4ed278bb664c22bb5e32ff237 Mon Sep 17 00:00:00 2001 From: Mathieu Champlon Date: Thu, 16 Sep 2021 15:46:27 +0200 Subject: [PATCH 1/2] Fix typo Signed-off-by: Mathieu Champlon --- cli/command/container/attach.go | 2 +- cli/command/container/run.go | 2 +- cli/command/container/signals.go | 2 +- cli/command/container/start.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cli/command/container/attach.go b/cli/command/container/attach.go index a9e604f31f..60e5da3b48 100644 --- a/cli/command/container/attach.go +++ b/cli/command/container/attach.go @@ -97,7 +97,7 @@ func runAttach(dockerCli command.Cli, opts *attachOptions) error { } if opts.proxy && !c.Config.Tty { - sigc := notfiyAllSignals() + sigc := notifyAllSignals() go ForwardAllSignals(ctx, dockerCli, opts.container, sigc) defer signal.StopCatch(sigc) } diff --git a/cli/command/container/run.go b/cli/command/container/run.go index 103ca83ff0..bc1fc929b3 100644 --- a/cli/command/container/run.go +++ b/cli/command/container/run.go @@ -131,7 +131,7 @@ func runContainer(dockerCli command.Cli, opts *runOptions, copts *containerOptio return runStartContainerErr(err) } if opts.sigProxy { - sigc := notfiyAllSignals() + sigc := notifyAllSignals() go ForwardAllSignals(ctx, dockerCli, createResponse.ID, sigc) defer signal.StopCatch(sigc) } diff --git a/cli/command/container/signals.go b/cli/command/container/signals.go index dbfd7f0339..b8b746df5e 100644 --- a/cli/command/container/signals.go +++ b/cli/command/container/signals.go @@ -54,7 +54,7 @@ func ForwardAllSignals(ctx context.Context, cli command.Cli, cid string, sigc <- } } -func notfiyAllSignals() chan os.Signal { +func notifyAllSignals() chan os.Signal { sigc := make(chan os.Signal, 128) gosignal.Notify(sigc) return sigc diff --git a/cli/command/container/start.go b/cli/command/container/start.go index f2d6351421..9a8d72fb3f 100644 --- a/cli/command/container/start.go +++ b/cli/command/container/start.go @@ -74,7 +74,7 @@ func runStart(dockerCli command.Cli, opts *startOptions) error { // We always use c.ID instead of container to maintain consistency during `docker start` if !c.Config.Tty { - sigc := notfiyAllSignals() + sigc := notifyAllSignals() go ForwardAllSignals(ctx, dockerCli, c.ID, sigc) defer signal.StopCatch(sigc) } From a4e7460872235467d4933139e1cd7e238544de61 Mon Sep 17 00:00:00 2001 From: Mathieu Champlon Date: Thu, 16 Sep 2021 16:17:20 +0200 Subject: [PATCH 2/2] Bump moby/sys This adds a Windows TERM signal which makes propagation of termination to containers work properly. Signed-off-by: Mathieu Champlon --- vendor.conf | 2 +- vendor/github.com/moby/sys/mount/flags_bsd.go | 1 + .../github.com/moby/sys/mount/flags_unix.go | 3 ++- vendor/github.com/moby/sys/mount/go.mod | 6 ++--- .../github.com/moby/sys/mount/mount_errors.go | 1 + .../github.com/moby/sys/mount/mount_unix.go | 3 ++- .../moby/sys/mount/mounter_freebsd.go | 1 + .../moby/sys/mount/mounter_linux.go | 1 - .../moby/sys/mount/mounter_openbsd.go | 1 + .../moby/sys/mount/mounter_unsupported.go | 1 + vendor/github.com/moby/sys/mountinfo/go.mod | 4 +-- .../moby/sys/mountinfo/mounted_linux.go | 11 ++++---- .../moby/sys/mountinfo/mounted_unix.go | 16 ++--------- .../moby/sys/mountinfo/mountinfo.go | 9 ++++--- .../moby/sys/mountinfo/mountinfo_bsd.go | 9 +++++-- .../moby/sys/mountinfo/mountinfo_linux.go | 27 +++++++------------ .../sys/mountinfo/mountinfo_unsupported.go | 3 ++- vendor/github.com/moby/sys/signal/go.mod | 4 +-- vendor/github.com/moby/sys/signal/signal.go | 4 +-- .../moby/sys/signal/signal_darwin.go | 2 +- .../moby/sys/signal/signal_freebsd.go | 2 +- .../moby/sys/signal/signal_linux.go | 1 + .../moby/sys/signal/signal_linux_mipsx.go | 1 + .../github.com/moby/sys/signal/signal_unix.go | 3 +-- .../moby/sys/signal/signal_unsupported.go | 1 + .../moby/sys/signal/signal_windows.go | 22 ++++++++++----- vendor/github.com/moby/sys/symlink/fs_unix.go | 1 + .../github.com/moby/sys/symlink/fs_windows.go | 4 +-- vendor/github.com/moby/sys/symlink/go.mod | 4 +-- 29 files changed, 76 insertions(+), 72 deletions(-) diff --git a/vendor.conf b/vendor.conf index f0bc0f03b9..d52da77de7 100755 --- a/vendor.conf +++ b/vendor.conf @@ -45,7 +45,7 @@ github.com/Microsoft/go-winio 5c2e05d71961716a6c392a06ada4 github.com/miekg/pkcs11 210dc1e16747c5ba98a03bcbcf728c38086ea357 # v1.0.3 github.com/mitchellh/mapstructure d16e9488127408e67948eb43b6d3fbb9f222da10 # v1.3.2 github.com/moby/buildkit 9f254e18360a24c2ae47b26f772c3c89533bcbb7 # master / v0.9.0-dev -github.com/moby/sys 9b0136d132d8e0d1c116a38d7ec9af70d3a59536 # signal/v0.5.0 (latest tag, either mount/vXXX, mountinfo/vXXX, signal/vXXX, or symlink/vXXX) +github.com/moby/sys 03b9f8d59a07f5206a2264105f4903a222aea964 # signal/v0.6.0 (latest tag, either mount/vXXX, mountinfo/vXXX, signal/vXXX, or symlink/vXXX) github.com/moby/term 3f7ff695adc6a35abc925370dd0a4dafb48ec64d github.com/modern-go/concurrent bacd9c7ef1dd9b15be4a9909b8ac7a4e313eec94 # 1.0.3 github.com/modern-go/reflect2 94122c33edd36123c84d5368cfb2b69df93a0ec8 # v1.0.1 diff --git a/vendor/github.com/moby/sys/mount/flags_bsd.go b/vendor/github.com/moby/sys/mount/flags_bsd.go index 27d8440aab..a7f8a71957 100644 --- a/vendor/github.com/moby/sys/mount/flags_bsd.go +++ b/vendor/github.com/moby/sys/mount/flags_bsd.go @@ -1,3 +1,4 @@ +//go:build freebsd || openbsd // +build freebsd openbsd package mount diff --git a/vendor/github.com/moby/sys/mount/flags_unix.go b/vendor/github.com/moby/sys/mount/flags_unix.go index 995d72807c..19fa61fcca 100644 --- a/vendor/github.com/moby/sys/mount/flags_unix.go +++ b/vendor/github.com/moby/sys/mount/flags_unix.go @@ -1,3 +1,4 @@ +//go:build !darwin && !windows // +build !darwin,!windows package mount @@ -101,7 +102,7 @@ func MergeTmpfsOptions(options []string) ([]string, error) { } opt := strings.SplitN(option, "=", 2) if len(opt) != 2 || !validFlags[opt[0]] { - return nil, fmt.Errorf("Invalid tmpfs option %q", opt) + return nil, fmt.Errorf("invalid tmpfs option %q", opt) } if !dataCollisions[opt[0]] { // We prepend the option and add to collision map diff --git a/vendor/github.com/moby/sys/mount/go.mod b/vendor/github.com/moby/sys/mount/go.mod index b08f010955..b8c29b9bf5 100644 --- a/vendor/github.com/moby/sys/mount/go.mod +++ b/vendor/github.com/moby/sys/mount/go.mod @@ -1,8 +1,8 @@ module github.com/moby/sys/mount -go 1.14 +go 1.16 require ( - github.com/moby/sys/mountinfo v0.4.1 - golang.org/x/sys v0.0.0-20200922070232-aee5d888a860 + github.com/moby/sys/mountinfo v0.5.0 + golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359 ) diff --git a/vendor/github.com/moby/sys/mount/mount_errors.go b/vendor/github.com/moby/sys/mount/mount_errors.go index 936a26373b..2bd1ef7f15 100644 --- a/vendor/github.com/moby/sys/mount/mount_errors.go +++ b/vendor/github.com/moby/sys/mount/mount_errors.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package mount diff --git a/vendor/github.com/moby/sys/mount/mount_unix.go b/vendor/github.com/moby/sys/mount/mount_unix.go index a250bfc80a..4053fbbeb8 100644 --- a/vendor/github.com/moby/sys/mount/mount_unix.go +++ b/vendor/github.com/moby/sys/mount/mount_unix.go @@ -1,3 +1,4 @@ +//go:build !darwin && !windows // +build !darwin,!windows package mount @@ -22,7 +23,7 @@ func Mount(device, target, mType, options string) error { // a normal unmount. If target is not a mount point, no error is returned. func Unmount(target string) error { err := unix.Unmount(target, mntDetach) - if err == nil || err == unix.EINVAL { + if err == nil || err == unix.EINVAL { //nolint:errorlint // unix errors are bare // Ignore "not mounted" error here. Note the same error // can be returned if flags are invalid, so this code // assumes that the flags value is always correct. diff --git a/vendor/github.com/moby/sys/mount/mounter_freebsd.go b/vendor/github.com/moby/sys/mount/mounter_freebsd.go index 9b2d26c4af..1fffb69015 100644 --- a/vendor/github.com/moby/sys/mount/mounter_freebsd.go +++ b/vendor/github.com/moby/sys/mount/mounter_freebsd.go @@ -1,3 +1,4 @@ +//go:build freebsd && cgo // +build freebsd,cgo package mount diff --git a/vendor/github.com/moby/sys/mount/mounter_linux.go b/vendor/github.com/moby/sys/mount/mounter_linux.go index 0c477cc3d7..4e18f4b678 100644 --- a/vendor/github.com/moby/sys/mount/mounter_linux.go +++ b/vendor/github.com/moby/sys/mount/mounter_linux.go @@ -65,7 +65,6 @@ func mount(device, target, mType string, flags uintptr, data string) error { flags: oflags | unix.MS_REMOUNT, err: err, } - } } diff --git a/vendor/github.com/moby/sys/mount/mounter_openbsd.go b/vendor/github.com/moby/sys/mount/mounter_openbsd.go index 28cddf16d3..3c0718b907 100644 --- a/vendor/github.com/moby/sys/mount/mounter_openbsd.go +++ b/vendor/github.com/moby/sys/mount/mounter_openbsd.go @@ -1,3 +1,4 @@ +//go:build openbsd && cgo // +build openbsd,cgo /* diff --git a/vendor/github.com/moby/sys/mount/mounter_unsupported.go b/vendor/github.com/moby/sys/mount/mounter_unsupported.go index e7ff5bd9ff..31fb7235b0 100644 --- a/vendor/github.com/moby/sys/mount/mounter_unsupported.go +++ b/vendor/github.com/moby/sys/mount/mounter_unsupported.go @@ -1,3 +1,4 @@ +//go:build (!linux && !freebsd && !openbsd && !windows) || (freebsd && !cgo) || (openbsd && !cgo) // +build !linux,!freebsd,!openbsd,!windows freebsd,!cgo openbsd,!cgo package mount diff --git a/vendor/github.com/moby/sys/mountinfo/go.mod b/vendor/github.com/moby/sys/mountinfo/go.mod index 9749ea96d9..1cc3efcf74 100644 --- a/vendor/github.com/moby/sys/mountinfo/go.mod +++ b/vendor/github.com/moby/sys/mountinfo/go.mod @@ -1,5 +1,5 @@ module github.com/moby/sys/mountinfo -go 1.14 +go 1.16 -require golang.org/x/sys v0.0.0-20200909081042-eff7692f9009 +require golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359 diff --git a/vendor/github.com/moby/sys/mountinfo/mounted_linux.go b/vendor/github.com/moby/sys/mountinfo/mounted_linux.go index bc9f6b2ad3..5c9e3e30e6 100644 --- a/vendor/github.com/moby/sys/mountinfo/mounted_linux.go +++ b/vendor/github.com/moby/sys/mountinfo/mounted_linux.go @@ -16,9 +16,6 @@ func mountedByOpenat2(path string) (bool, error) { Flags: unix.O_PATH | unix.O_CLOEXEC, }) if err != nil { - if err == unix.ENOENT { // not a mount - return false, nil - } return false, &os.PathError{Op: "openat2", Path: dir, Err: err} } fd, err := unix.Openat2(dirfd, last, &unix.OpenHow{ @@ -26,20 +23,22 @@ func mountedByOpenat2(path string) (bool, error) { Resolve: unix.RESOLVE_NO_XDEV, }) _ = unix.Close(dirfd) - switch err { + switch err { //nolint:errorlint // unix errors are bare case nil: // definitely not a mount _ = unix.Close(fd) return false, nil case unix.EXDEV: // definitely a mount return true, nil - case unix.ENOENT: // not a mount - return false, nil } // not sure return false, &os.PathError{Op: "openat2", Path: path, Err: err} } func mounted(path string) (bool, error) { + path, err := normalizePath(path) + if err != nil { + return false, err + } // Try a fast path, using openat2() with RESOLVE_NO_XDEV. mounted, err := mountedByOpenat2(path) if err == nil { diff --git a/vendor/github.com/moby/sys/mountinfo/mounted_unix.go b/vendor/github.com/moby/sys/mountinfo/mounted_unix.go index efb03978b1..45ddad236f 100644 --- a/vendor/github.com/moby/sys/mountinfo/mounted_unix.go +++ b/vendor/github.com/moby/sys/mountinfo/mounted_unix.go @@ -1,9 +1,9 @@ -// +build linux freebsd,cgo openbsd,cgo +//go:build linux || (freebsd && cgo) || (openbsd && cgo) || (darwin && cgo) +// +build linux freebsd,cgo openbsd,cgo darwin,cgo package mountinfo import ( - "errors" "fmt" "os" "path/filepath" @@ -15,10 +15,6 @@ func mountedByStat(path string) (bool, error) { var st unix.Stat_t if err := unix.Lstat(path, &st); err != nil { - if err == unix.ENOENT { - // Treat ENOENT as "not mounted". - return false, nil - } return false, &os.PathError{Op: "stat", Path: path, Err: err} } dev := st.Dev @@ -49,14 +45,6 @@ func normalizePath(path string) (realPath string, err error) { } func mountedByMountinfo(path string) (bool, error) { - path, err := normalizePath(path) - if err != nil { - if errors.Is(err, unix.ENOENT) { - // treat ENOENT as "not mounted" - return false, nil - } - return false, err - } entries, err := GetMounts(SingleEntryFilter(path)) if err != nil { return false, err diff --git a/vendor/github.com/moby/sys/mountinfo/mountinfo.go b/vendor/github.com/moby/sys/mountinfo/mountinfo.go index 403a893310..9867a66dd8 100644 --- a/vendor/github.com/moby/sys/mountinfo/mountinfo.go +++ b/vendor/github.com/moby/sys/mountinfo/mountinfo.go @@ -10,11 +10,12 @@ func GetMounts(f FilterFunc) ([]*Info, error) { return parseMountTable(f) } -// Mounted determines if a specified path is a mount point. +// Mounted determines if a specified path is a mount point. In case of any +// error, false (and an error) is returned. // -// The argument must be an absolute path, with all symlinks resolved, and clean. -// One way to ensure it is to process the path using filepath.Abs followed by -// filepath.EvalSymlinks before calling this function. +// The non-existent path returns an error. If a caller is not interested +// in this particular error, it should handle it separately using e.g. +// errors.Is(err, os.ErrNotExist). func Mounted(path string) (bool, error) { // root is always mounted if path == string(os.PathSeparator) { diff --git a/vendor/github.com/moby/sys/mountinfo/mountinfo_bsd.go b/vendor/github.com/moby/sys/mountinfo/mountinfo_bsd.go index b1c12d02b5..d5513a26d2 100644 --- a/vendor/github.com/moby/sys/mountinfo/mountinfo_bsd.go +++ b/vendor/github.com/moby/sys/mountinfo/mountinfo_bsd.go @@ -1,4 +1,5 @@ -// +build freebsd,cgo openbsd,cgo +//go:build (freebsd && cgo) || (openbsd && cgo) || (darwin && cgo) +// +build freebsd,cgo openbsd,cgo darwin,cgo package mountinfo @@ -21,7 +22,7 @@ func parseMountTable(filter FilterFunc) ([]*Info, error) { count := int(C.getmntinfo(&rawEntries, C.MNT_WAIT)) if count == 0 { - return nil, fmt.Errorf("Failed to call getmntinfo") + return nil, fmt.Errorf("failed to call getmntinfo") } var entries []C.struct_statfs @@ -55,6 +56,10 @@ func parseMountTable(filter FilterFunc) ([]*Info, error) { } func mounted(path string) (bool, error) { + path, err := normalizePath(path) + if err != nil { + return false, err + } // Fast path: compare st.st_dev fields. // This should always work for FreeBSD and OpenBSD. mounted, err := mountedByStat(path) diff --git a/vendor/github.com/moby/sys/mountinfo/mountinfo_linux.go b/vendor/github.com/moby/sys/mountinfo/mountinfo_linux.go index f09a70fa0d..59332b07bf 100644 --- a/vendor/github.com/moby/sys/mountinfo/mountinfo_linux.go +++ b/vendor/github.com/moby/sys/mountinfo/mountinfo_linux.go @@ -52,7 +52,7 @@ func GetMountsFromReader(r io.Reader, filter FilterFunc) ([]*Info, error) { numFields := len(fields) if numFields < 10 { // should be at least 10 fields - return nil, fmt.Errorf("Parsing '%s' failed: not enough fields (%d)", text, numFields) + return nil, fmt.Errorf("parsing '%s' failed: not enough fields (%d)", text, numFields) } // separator field @@ -67,7 +67,7 @@ func GetMountsFromReader(r io.Reader, filter FilterFunc) ([]*Info, error) { for fields[sepIdx] != "-" { sepIdx-- if sepIdx == 5 { - return nil, fmt.Errorf("Parsing '%s' failed: missing - separator", text) + return nil, fmt.Errorf("parsing '%s' failed: missing - separator", text) } } @@ -75,46 +75,39 @@ func GetMountsFromReader(r io.Reader, filter FilterFunc) ([]*Info, error) { p.Mountpoint, err = unescape(fields[4]) if err != nil { - return nil, fmt.Errorf("Parsing '%s' failed: mount point: %w", fields[4], err) + return nil, fmt.Errorf("parsing '%s' failed: mount point: %w", fields[4], err) } p.FSType, err = unescape(fields[sepIdx+1]) if err != nil { - return nil, fmt.Errorf("Parsing '%s' failed: fstype: %w", fields[sepIdx+1], err) + return nil, fmt.Errorf("parsing '%s' failed: fstype: %w", fields[sepIdx+1], err) } p.Source, err = unescape(fields[sepIdx+2]) if err != nil { - return nil, fmt.Errorf("Parsing '%s' failed: source: %w", fields[sepIdx+2], err) + return nil, fmt.Errorf("parsing '%s' failed: source: %w", fields[sepIdx+2], err) } p.VFSOptions = fields[sepIdx+3] // ignore any numbers parsing errors, as there should not be any p.ID, _ = strconv.Atoi(fields[0]) p.Parent, _ = strconv.Atoi(fields[1]) - mm := strings.Split(fields[2], ":") + mm := strings.SplitN(fields[2], ":", 3) if len(mm) != 2 { - return nil, fmt.Errorf("Parsing '%s' failed: unexpected minor:major pair %s", text, mm) + return nil, fmt.Errorf("parsing '%s' failed: unexpected major:minor pair %s", text, mm) } p.Major, _ = strconv.Atoi(mm[0]) p.Minor, _ = strconv.Atoi(mm[1]) p.Root, err = unescape(fields[3]) if err != nil { - return nil, fmt.Errorf("Parsing '%s' failed: root: %w", fields[3], err) + return nil, fmt.Errorf("parsing '%s' failed: root: %w", fields[3], err) } p.Options = fields[5] // zero or more optional fields - switch { - case sepIdx == 6: - // zero, do nothing - case sepIdx == 7: - p.Optional = fields[6] - default: - p.Optional = strings.Join(fields[6:sepIdx-1], " ") - } + p.Optional = strings.Join(fields[6:sepIdx], " ") - // Run the filter after parsing all of the fields. + // Run the filter after parsing all fields. var skip, stop bool if filter != nil { skip, stop = filter(p) diff --git a/vendor/github.com/moby/sys/mountinfo/mountinfo_unsupported.go b/vendor/github.com/moby/sys/mountinfo/mountinfo_unsupported.go index d33ebca096..95769a76da 100644 --- a/vendor/github.com/moby/sys/mountinfo/mountinfo_unsupported.go +++ b/vendor/github.com/moby/sys/mountinfo/mountinfo_unsupported.go @@ -1,4 +1,5 @@ -// +build !windows,!linux,!freebsd,!openbsd freebsd,!cgo openbsd,!cgo +//go:build (!windows && !linux && !freebsd && !openbsd && !darwin) || (freebsd && !cgo) || (openbsd && !cgo) || (darwin && !cgo) +// +build !windows,!linux,!freebsd,!openbsd,!darwin freebsd,!cgo openbsd,!cgo darwin,!cgo package mountinfo diff --git a/vendor/github.com/moby/sys/signal/go.mod b/vendor/github.com/moby/sys/signal/go.mod index c48d5aecce..a9e4436859 100644 --- a/vendor/github.com/moby/sys/signal/go.mod +++ b/vendor/github.com/moby/sys/signal/go.mod @@ -1,5 +1,5 @@ module github.com/moby/sys/signal -go 1.13 +go 1.16 -require golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c +require golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359 diff --git a/vendor/github.com/moby/sys/signal/signal.go b/vendor/github.com/moby/sys/signal/signal.go index c9cd046cfa..3fbf1aac2d 100644 --- a/vendor/github.com/moby/sys/signal/signal.go +++ b/vendor/github.com/moby/sys/signal/signal.go @@ -39,13 +39,13 @@ func ParseSignal(rawSignal string) (syscall.Signal, error) { s, err := strconv.Atoi(rawSignal) if err == nil { if s == 0 { - return -1, fmt.Errorf("Invalid signal: %s", rawSignal) + return -1, fmt.Errorf("invalid signal: %s", rawSignal) } return syscall.Signal(s), nil } signal, ok := SignalMap[strings.TrimPrefix(strings.ToUpper(rawSignal), "SIG")] if !ok { - return -1, fmt.Errorf("Invalid signal: %s", rawSignal) + return -1, fmt.Errorf("invalid signal: %s", rawSignal) } return signal, nil } diff --git a/vendor/github.com/moby/sys/signal/signal_darwin.go b/vendor/github.com/moby/sys/signal/signal_darwin.go index 946de87e94..355b0d2fc0 100644 --- a/vendor/github.com/moby/sys/signal/signal_darwin.go +++ b/vendor/github.com/moby/sys/signal/signal_darwin.go @@ -8,7 +8,7 @@ import ( var SignalMap = map[string]syscall.Signal{ "ABRT": syscall.SIGABRT, "ALRM": syscall.SIGALRM, - "BUG": syscall.SIGBUS, + "BUS": syscall.SIGBUS, "CHLD": syscall.SIGCHLD, "CONT": syscall.SIGCONT, "EMT": syscall.SIGEMT, diff --git a/vendor/github.com/moby/sys/signal/signal_freebsd.go b/vendor/github.com/moby/sys/signal/signal_freebsd.go index 6b9569bb75..b9f800e8fe 100644 --- a/vendor/github.com/moby/sys/signal/signal_freebsd.go +++ b/vendor/github.com/moby/sys/signal/signal_freebsd.go @@ -8,7 +8,7 @@ import ( var SignalMap = map[string]syscall.Signal{ "ABRT": syscall.SIGABRT, "ALRM": syscall.SIGALRM, - "BUF": syscall.SIGBUS, + "BUS": syscall.SIGBUS, "CHLD": syscall.SIGCHLD, "CONT": syscall.SIGCONT, "EMT": syscall.SIGEMT, diff --git a/vendor/github.com/moby/sys/signal/signal_linux.go b/vendor/github.com/moby/sys/signal/signal_linux.go index 692b9f9e77..f2f658891f 100644 --- a/vendor/github.com/moby/sys/signal/signal_linux.go +++ b/vendor/github.com/moby/sys/signal/signal_linux.go @@ -1,3 +1,4 @@ +//go:build !mips && !mipsle && !mips64 && !mips64le // +build !mips,!mipsle,!mips64,!mips64le package signal diff --git a/vendor/github.com/moby/sys/signal/signal_linux_mipsx.go b/vendor/github.com/moby/sys/signal/signal_linux_mipsx.go index 138a840cc6..72f035ae72 100644 --- a/vendor/github.com/moby/sys/signal/signal_linux_mipsx.go +++ b/vendor/github.com/moby/sys/signal/signal_linux_mipsx.go @@ -1,3 +1,4 @@ +//go:build linux && (mips || mipsle || mips64 || mips64le) // +build linux // +build mips mipsle mips64 mips64le diff --git a/vendor/github.com/moby/sys/signal/signal_unix.go b/vendor/github.com/moby/sys/signal/signal_unix.go index 5d058fd56b..93f01e289d 100644 --- a/vendor/github.com/moby/sys/signal/signal_unix.go +++ b/vendor/github.com/moby/sys/signal/signal_unix.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package signal @@ -16,6 +17,4 @@ const ( SIGWINCH = syscall.SIGWINCH // SIGPIPE is a signal sent to a process when a pipe is written to before the other end is open for reading SIGPIPE = syscall.SIGPIPE - // DefaultStopSignal is the syscall signal used to stop a container in unix systems. - DefaultStopSignal = "SIGTERM" ) diff --git a/vendor/github.com/moby/sys/signal/signal_unsupported.go b/vendor/github.com/moby/sys/signal/signal_unsupported.go index 161ba27397..f4200fbc41 100644 --- a/vendor/github.com/moby/sys/signal/signal_unsupported.go +++ b/vendor/github.com/moby/sys/signal/signal_unsupported.go @@ -1,3 +1,4 @@ +//go:build !linux && !darwin && !freebsd && !windows // +build !linux,!darwin,!freebsd,!windows package signal diff --git a/vendor/github.com/moby/sys/signal/signal_windows.go b/vendor/github.com/moby/sys/signal/signal_windows.go index c84a63e821..cb459d17c2 100644 --- a/vendor/github.com/moby/sys/signal/signal_windows.go +++ b/vendor/github.com/moby/sys/signal/signal_windows.go @@ -2,6 +2,8 @@ package signal import ( "syscall" + + "golang.org/x/sys/windows" ) // Signals used in cli/command (no windows equivalent, use @@ -10,17 +12,23 @@ const ( SIGCHLD = syscall.Signal(0xff) SIGWINCH = syscall.Signal(0xff) SIGPIPE = syscall.Signal(0xff) - // DefaultStopSignal is the syscall signal used to stop a container in windows systems. - DefaultStopSignal = "15" ) // SignalMap is a map of "supported" signals. As per the comment in GOLang's // ztypes_windows.go: "More invented values for signals". Windows doesn't // really support signals in any way, shape or form that Unix does. -// -// We have these so that docker kill can be used to gracefully (TERM) and -// forcibly (KILL) terminate a container on Windows. var SignalMap = map[string]syscall.Signal{ - "KILL": syscall.SIGKILL, - "TERM": syscall.SIGTERM, + "ABRT": syscall.Signal(windows.SIGABRT), + "ALRM": syscall.Signal(windows.SIGALRM), + "BUS": syscall.Signal(windows.SIGBUS), + "FPE": syscall.Signal(windows.SIGFPE), + "HUP": syscall.Signal(windows.SIGHUP), + "ILL": syscall.Signal(windows.SIGILL), + "INT": syscall.Signal(windows.SIGINT), + "KILL": syscall.Signal(windows.SIGKILL), + "PIPE": syscall.Signal(windows.SIGPIPE), + "QUIT": syscall.Signal(windows.SIGQUIT), + "SEGV": syscall.Signal(windows.SIGSEGV), + "TERM": syscall.Signal(windows.SIGTERM), + "TRAP": syscall.Signal(windows.SIGTRAP), } diff --git a/vendor/github.com/moby/sys/symlink/fs_unix.go b/vendor/github.com/moby/sys/symlink/fs_unix.go index ef960a0879..13ce825118 100644 --- a/vendor/github.com/moby/sys/symlink/fs_unix.go +++ b/vendor/github.com/moby/sys/symlink/fs_unix.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package symlink diff --git a/vendor/github.com/moby/sys/symlink/fs_windows.go b/vendor/github.com/moby/sys/symlink/fs_windows.go index 7603fafa68..87fd1b8854 100644 --- a/vendor/github.com/moby/sys/symlink/fs_windows.go +++ b/vendor/github.com/moby/sys/symlink/fs_windows.go @@ -89,7 +89,7 @@ func walkSymlinks(path string) (string, error) { var b bytes.Buffer for n := 0; path != ""; n++ { if n > maxIter { - return "", errors.New("EvalSymlinks: too many links in " + originalPath) + return "", errors.New("too many links in " + originalPath) } // A path beginning with `\\?\` represents the root, so automatically @@ -101,7 +101,7 @@ func walkSymlinks(path string) (string, error) { } // find next path component, p - var i = -1 + i := -1 for j, c := range path { if c < utf8RuneSelf && os.IsPathSeparator(uint8(c)) { i = j diff --git a/vendor/github.com/moby/sys/symlink/go.mod b/vendor/github.com/moby/sys/symlink/go.mod index a65169000b..1c18b6a0d4 100644 --- a/vendor/github.com/moby/sys/symlink/go.mod +++ b/vendor/github.com/moby/sys/symlink/go.mod @@ -1,5 +1,5 @@ module github.com/moby/sys/symlink -go 1.14 +go 1.16 -require golang.org/x/sys v0.0.0-20200922070232-aee5d888a860 +require golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359