From 8da8b005554195db6000451d3e29cba62eab139d Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sat, 10 Oct 2026 15:28:26 +0200 Subject: [PATCH] vendor: github.com/Microsoft/go-winio v0.6.3 - improve interoperability with stdlib sentinel errors and deprecate aliases full diff: https://github.com/Microsoft/go-winio/compare/f19d9717deb0...v0.6.3 Signed-off-by: Sebastiaan van Stijn --- vendor.mod | 2 +- vendor.sum | 4 +-- vendor/github.com/Microsoft/go-winio/file.go | 34 ++++++++++++++----- .../github.com/Microsoft/go-winio/hvsock.go | 2 +- vendor/github.com/Microsoft/go-winio/pipe.go | 23 ++++++------- vendor/modules.txt | 2 +- 6 files changed, 42 insertions(+), 25 deletions(-) diff --git a/vendor.mod b/vendor.mod index d6ca6bedd395..9b14b2e61eb9 100644 --- a/vendor.mod +++ b/vendor.mod @@ -71,7 +71,7 @@ require ( require ( github.com/Azure/go-ansiterm v0.0.0-20261006220739-8c912ac31dd4 // indirect - github.com/Microsoft/go-winio v0.6.3-0.20260930231756-f19d9717deb0 // indirect; see https://github.com/microsoft/hcsshim/pull/2545 + github.com/Microsoft/go-winio v0.6.3 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cenkalti/backoff/v5 v5.0.3 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect diff --git a/vendor.sum b/vendor.sum index 80f9952157dd..aa0e5e45f982 100644 --- a/vendor.sum +++ b/vendor.sum @@ -4,8 +4,8 @@ github.com/AdaLogics/go-fuzz-headers v0.0.0-20240806141605-e8a1dd7889d6 h1:He8af github.com/AdaLogics/go-fuzz-headers v0.0.0-20240806141605-e8a1dd7889d6/go.mod h1:8o94RPi1/7XTJvwPpRSzSUedZrtlirdB3r9Z20bi2f8= github.com/Azure/go-ansiterm v0.0.0-20261006220739-8c912ac31dd4 h1:m2xcjRABtG288vnlV3U/PKh/HnPURxZp50RKNUwBxM8= github.com/Azure/go-ansiterm v0.0.0-20261006220739-8c912ac31dd4/go.mod h1:MTUE7ZuZO89FAtAwozGg6AWD83pcdefnEq5gF82MB8s= -github.com/Microsoft/go-winio v0.6.3-0.20260930231756-f19d9717deb0 h1:71VU8kW/LCxJkx41+YYys1EgQO+AUnPa1TrxTSyYUCU= -github.com/Microsoft/go-winio v0.6.3-0.20260930231756-f19d9717deb0/go.mod h1:ma0QpxizD4fyyzJ1C7MIblymTD2Nxz5Mho/3CepwIZg= +github.com/Microsoft/go-winio v0.6.3 h1:M/52tsoyTfwaxajLnXZm7PqkbMGRH8iSWP+8fcg9MQ4= +github.com/Microsoft/go-winio v0.6.3/go.mod h1:ma0QpxizD4fyyzJ1C7MIblymTD2Nxz5Mho/3CepwIZg= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/cenkalti/backoff/v5 v5.0.3 h1:ZN+IMa753KfX5hd8vVaMixjnqRZ3y8CuJKRKj1xcsSM= diff --git a/vendor/github.com/Microsoft/go-winio/file.go b/vendor/github.com/Microsoft/go-winio/file.go index 19c5f8940ead..449bb3bd1b9d 100644 --- a/vendor/github.com/Microsoft/go-winio/file.go +++ b/vendor/github.com/Microsoft/go-winio/file.go @@ -3,8 +3,9 @@ package winio import ( - "errors" + "context" "io" + "os" "runtime" "sync" "sync/atomic" @@ -20,16 +21,33 @@ import ( //sys setFileCompletionNotificationModes(h windows.Handle, flags uint8) (err error) = SetFileCompletionNotificationModes //sys wsaGetOverlappedResult(h windows.Handle, o *windows.Overlapped, bytes *uint32, wait bool, flags *uint32) (err error) = ws2_32.WSAGetOverlappedResult -var ( - ErrFileClosed = errors.New("file has already been closed") - ErrTimeout = &timeoutError{} -) - +// ErrFileClosed is returned when an operation is performed on a closed file. +// +// Deprecated: use [os.ErrClosed] instead. +var ErrFileClosed = os.ErrClosed + +// ErrTimeout is returned when an I/O operation exceeds its deadline. +// +// It matches both [context.DeadlineExceeded] and [os.ErrDeadlineExceeded] +// with [errors.Is]. +var ErrTimeout error = &timeoutError{} + +// timeoutError preserves the historical "i/o timeout" error while matching +// both context.DeadlineExceeded and os.ErrDeadlineExceeded through errors.Is. +// This mirrors the behavior of net.errTimeout: +// https://github.com/golang/go/blob/go1.27.1/src/net/net.go +// +// TODO: consider replacing ErrTimeout with os.ErrDeadlineExceeded if os.ErrDeadlineExceeded is changed to match context.DeadlineExceeded. type timeoutError struct{} func (*timeoutError) Error() string { return "i/o timeout" } func (*timeoutError) Timeout() bool { return true } func (*timeoutError) Temporary() bool { return true } +func (*timeoutError) Unwrap() error { return os.ErrDeadlineExceeded } + +func (*timeoutError) Is(err error) bool { + return err == context.DeadlineExceeded +} type timeoutChan chan struct{} @@ -143,7 +161,7 @@ func (f *win32File) prepareIO() (*ioOperation, error) { f.wgLock.RLock() if f.closing.Load() { f.wgLock.RUnlock() - return nil, ErrFileClosed + return nil, os.ErrClosed } f.wg.Add(1) f.wgLock.RUnlock() @@ -192,7 +210,7 @@ func (f *win32File) asyncIO(c *ioOperation, d *deadlineHandler, bytes uint32, er err = r.err if err == windows.ERROR_OPERATION_ABORTED { //nolint:errorlint // err is Errno if f.closing.Load() { - err = ErrFileClosed + err = os.ErrClosed } } else if err != nil && f.socket { // err is from Win32. Query the overlapped structure to get the winsock error. diff --git a/vendor/github.com/Microsoft/go-winio/hvsock.go b/vendor/github.com/Microsoft/go-winio/hvsock.go index d4960f5b0a11..df2008f6f679 100644 --- a/vendor/github.com/Microsoft/go-winio/hvsock.go +++ b/vendor/github.com/Microsoft/go-winio/hvsock.go @@ -441,7 +441,7 @@ func canRedial(err error) bool { func (conn *HvsockConn) opErr(op string, err error) error { // translate from "file closed" to "socket closed" - if errors.Is(err, ErrFileClosed) { + if errors.Is(err, os.ErrClosed) { err = socket.ErrSocketClosed } return &net.OpError{Op: op, Net: "hvsock", Source: &conn.local, Addr: &conn.remote, Err: err} diff --git a/vendor/github.com/Microsoft/go-winio/pipe.go b/vendor/github.com/Microsoft/go-winio/pipe.go index 16a42584fc69..850fe3e53a10 100644 --- a/vendor/github.com/Microsoft/go-winio/pipe.go +++ b/vendor/github.com/Microsoft/go-winio/pipe.go @@ -102,12 +102,10 @@ func (status ntStatus) Err() error { return rtlNtStatusToDosError(status) } -var ( - // ErrPipeListenerClosed is returned for pipe operations on listeners that have been closed. - ErrPipeListenerClosed = net.ErrClosed - - errPipeWriteClosed = errors.New("pipe has been closed for write") -) +// ErrPipeListenerClosed is returned for pipe operations on listeners that have been closed. +// +// Deprecated: use [net.ErrClosed] instead. +var ErrPipeListenerClosed = net.ErrClosed type win32Pipe struct { *win32File @@ -144,9 +142,10 @@ func (f *win32Pipe) Disconnect() error { } // CloseWrite closes the write side of a message pipe in byte mode. +// It returns [io.ErrClosedPipe] if the write side is already closed. func (f *win32MessageBytePipe) CloseWrite() error { if f.writeClosed { - return errPipeWriteClosed + return io.ErrClosedPipe } err := f.win32File.Flush() if err != nil { @@ -161,10 +160,10 @@ func (f *win32MessageBytePipe) CloseWrite() error { } // Write writes bytes to a message pipe in byte mode. Zero-byte writes are ignored, since -// they are used to implement CloseWrite(). +// they are used to implement CloseWrite. It returns [io.ErrClosedPipe] if the write side is closed. func (f *win32MessageBytePipe) Write(b []byte) (int, error) { if f.writeClosed { - return 0, errPipeWriteClosed + return 0, io.ErrClosedPipe } if len(b) == 0 { return 0, nil @@ -454,7 +453,7 @@ func (l *win32PipeListener) makeConnectedServerPipe() (*win32File, error) { _ = p.Close() p = nil <-ch - err = ErrPipeListenerClosed + err = net.ErrClosed } return p, err } @@ -479,7 +478,7 @@ func (l *win32PipeListener) listenerRoutine() { } } responseCh <- acceptResponse{p, err} - closed = err == ErrPipeListenerClosed //nolint:errorlint // err is Errno + closed = err == net.ErrClosed //nolint:errorlint // err is Errno } } windows.Close(l.firstHandle) @@ -571,7 +570,7 @@ func (l *win32PipeListener) Accept() (net.Conn, error) { } return &win32Pipe{win32File: response.f, path: l.path}, nil case <-l.doneCh: - return nil, ErrPipeListenerClosed + return nil, net.ErrClosed } } diff --git a/vendor/modules.txt b/vendor/modules.txt index c9f32360ea70..b1024ee9737b 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -5,7 +5,7 @@ dario.cat/mergo ## explicit; go 1.17 github.com/Azure/go-ansiterm github.com/Azure/go-ansiterm/winterm -# github.com/Microsoft/go-winio v0.6.3-0.20260930231756-f19d9717deb0 +# github.com/Microsoft/go-winio v0.6.3 ## explicit; go 1.26.0 github.com/Microsoft/go-winio github.com/Microsoft/go-winio/internal/fs