From adccf851faef19778df7b511a9ed4e036f5d28f8 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sat, 5 Nov 2022 17:08:24 +0100 Subject: [PATCH] vendor: update github.com/moby/sys to fix interrupt handling On termios platforms, interrupt signals are not generated in raw mode terminals as the ISIG setting is not enabled. Remove interrupt handler as it does nothing for raw mode and prevents other uses of INT signal with this library. This code seems to go back all the way to moby/moby#214 where signal handling was improved for monolithic docker repository. Raw mode -ISIG got reintroduced in https://github.com/moby/moby/commit/3f63b878076, but the INT handler was left behind. Signed-off-by: Sebastiaan van Stijn --- vendor.mod | 5 ++++- vendor.sum | 4 ++-- vendor/github.com/moby/term/term.go | 19 ------------------- vendor/github.com/moby/term/term_windows.go | 4 ---- vendor/modules.txt | 3 ++- 5 files changed, 8 insertions(+), 27 deletions(-) diff --git a/vendor.mod b/vendor.mod index 8292b5a5de5e..b6ddc1c3532f 100644 --- a/vendor.mod +++ b/vendor.mod @@ -26,7 +26,7 @@ require ( github.com/moby/swarmkit/v2 v2.0.0-20220721174824-48dd89375d0a github.com/moby/sys/sequential v0.5.0 github.com/moby/sys/signal v0.7.0 - github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6 + github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6 // FIXME(thaJeztah) replaced with https://github.com/moby/term/pull/31 github.com/morikuni/aec v1.0.0 github.com/opencontainers/go-digest v1.0.0 github.com/opencontainers/image-spec v1.0.3-0.20220303224323-02efb9a75ee1 @@ -44,6 +44,9 @@ require ( gotest.tools/v3 v3.3.0 ) +// FIXME(thaJeztah): testing https://github.com/moby/term/pull/31 +replace github.com/moby/term => github.com/enool/term v0.0.0-20221004191239-94b314a57d2e + require ( github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect github.com/Microsoft/go-winio v0.5.2 // indirect diff --git a/vendor.sum b/vendor.sum index 0addd92a6889..a6a6256b4207 100644 --- a/vendor.sum +++ b/vendor.sum @@ -123,6 +123,8 @@ github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDD github.com/docker/libtrust v0.0.0-20160708172513-aabc10ec26b7 h1:UhxFibDNY/bfvqU5CAUmr9zpesgbU6SWc8/B4mflAE4= github.com/docker/libtrust v0.0.0-20160708172513-aabc10ec26b7/go.mod h1:cyGadeNEkKy96OOhEzfZl+yxihPEzKnqJwvfuSUqbZE= github.com/dvsekhvalnov/jose2go v0.0.0-20170216131308-f21a8cedbbae/go.mod h1:7BvyPhdbLxMXIYTFPLsyJRFMsKmOZnQmzh6Gb+uquuM= +github.com/enool/term v0.0.0-20221004191239-94b314a57d2e h1:1ppF2arKNWoHyRWv3wRMYUAaxEArHPv2Oui05shMxtM= +github.com/enool/term v0.0.0-20221004191239-94b314a57d2e/go.mod h1:E2VnQOmVuvZB6UYnnDB0qG5Nq/1tD9acaOpo6xmt0Kw= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= @@ -290,8 +292,6 @@ github.com/moby/sys/signal v0.7.0 h1:25RW3d5TnQEoKvRbEKUGay6DCQ46IxAVTT9CUMgmsSI github.com/moby/sys/signal v0.7.0/go.mod h1:GQ6ObYZfqacOwTtlXvcmh9A26dVRul/hbOZn88Kg8Tg= github.com/moby/sys/symlink v0.2.0 h1:tk1rOM+Ljp0nFmfOIBtlV3rTDlWOwFRhjEeAhZB0nZc= github.com/moby/sys/symlink v0.2.0/go.mod h1:7uZVF2dqJjG/NsClqul95CqKOBRQyYSNnJ6BMgR/gFs= -github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6 h1:dcztxKSvZ4Id8iPpHERQBbIJfabdt4wUm5qy3wOL2Zc= -github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6/go.mod h1:E2VnQOmVuvZB6UYnnDB0qG5Nq/1tD9acaOpo6xmt0Kw= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= diff --git a/vendor/github.com/moby/term/term.go b/vendor/github.com/moby/term/term.go index 29c6acf1c7ef..e3c2b645bf37 100644 --- a/vendor/github.com/moby/term/term.go +++ b/vendor/github.com/moby/term/term.go @@ -6,10 +6,8 @@ package term import ( "errors" - "fmt" "io" "os" - "os/signal" "golang.org/x/sys/unix" ) @@ -81,7 +79,6 @@ func DisableEcho(fd uintptr, state *State) error { if err := tcset(fd, &newState); err != nil { return err } - handleInterrupt(fd, state) return nil } @@ -93,7 +90,6 @@ func SetRawTerminal(fd uintptr) (*State, error) { if err != nil { return nil, err } - handleInterrupt(fd, oldState) return oldState, err } @@ -103,18 +99,3 @@ func SetRawTerminal(fd uintptr) (*State, error) { func SetRawTerminalOutput(fd uintptr) (*State, error) { return nil, nil } - -func handleInterrupt(fd uintptr, state *State) { - sigchan := make(chan os.Signal, 1) - signal.Notify(sigchan, os.Interrupt) - go func() { - for range sigchan { - // quit cleanly and the new terminal item is on a new line - fmt.Println() - signal.Stop(sigchan) - close(sigchan) - RestoreTerminal(fd, state) - os.Exit(1) - } - }() -} diff --git a/vendor/github.com/moby/term/term_windows.go b/vendor/github.com/moby/term/term_windows.go index ba82960d4a6d..3cdc8edbdaaa 100644 --- a/vendor/github.com/moby/term/term_windows.go +++ b/vendor/github.com/moby/term/term_windows.go @@ -66,10 +66,6 @@ func StdStreams() (stdIn io.ReadCloser, stdOut, stdErr io.Writer) { } } - // Temporarily use STD_INPUT_HANDLE, STD_OUTPUT_HANDLE and - // STD_ERROR_HANDLE from syscall rather than x/sys/windows as long as - // go-ansiterm hasn't switch to x/sys/windows. - // TODO: switch back to x/sys/windows once go-ansiterm has switched if emulateStdin { h := uint32(windows.STD_INPUT_HANDLE) stdIn = windowsconsole.NewAnsiReader(int(h)) diff --git a/vendor/modules.txt b/vendor/modules.txt index 1ac898f95bbc..3b0f7a2ca7a1 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -177,7 +177,7 @@ github.com/moby/sys/signal # github.com/moby/sys/symlink v0.2.0 ## explicit; go 1.16 github.com/moby/sys/symlink -# github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6 +# github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6 => github.com/enool/term v0.0.0-20221004191239-94b314a57d2e ## explicit; go 1.13 github.com/moby/term github.com/moby/term/windows @@ -396,5 +396,6 @@ gotest.tools/v3/internal/format gotest.tools/v3/internal/source gotest.tools/v3/poll gotest.tools/v3/skip +# github.com/moby/term => github.com/enool/term v0.0.0-20221004191239-94b314a57d2e # github.com/docker/docker => github.com/docker/docker v20.10.3-0.20221021173910-5aac513617f0+incompatible # github.com/google/certificate-transparency-go => github.com/google/certificate-transparency-go v1.0.20