From e94ed33de1dbd143a76f8af497d2a8df71e6730b Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Wed, 26 Nov 2025 17:45:58 +0100 Subject: [PATCH] vendor: github.com/mistifyio/go-zfs/v3 v3.1.0 full diff: https://github.com/mistifyio/go-zfs/compare/v3.0.1...v3.1.0 Signed-off-by: Sebastiaan van Stijn --- go.mod | 2 +- go.sum | 4 +- .../github.com/mistifyio/go-zfs/v3/utils.go | 42 ++++++++++++++++++- vendor/modules.txt | 2 +- 4 files changed, 45 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index c679800bd7..009619c407 100644 --- a/go.mod +++ b/go.mod @@ -54,7 +54,7 @@ require ( github.com/in-toto/in-toto-golang v0.9.0 github.com/ishidawataru/sctp v0.0.0-20251114114122-19ddcbc6aae2 github.com/miekg/dns v1.1.66 - github.com/mistifyio/go-zfs/v3 v3.0.1 + github.com/mistifyio/go-zfs/v3 v3.1.0 github.com/mitchellh/copystructure v1.2.0 github.com/moby/buildkit v0.26.2 github.com/moby/docker-image-spec v1.3.1 diff --git a/go.sum b/go.sum index ab832c501e..faa2e554fc 100644 --- a/go.sum +++ b/go.sum @@ -405,8 +405,8 @@ github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3N github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso= github.com/miekg/dns v1.1.66 h1:FeZXOS3VCVsKnEAd+wBkjMC3D2K+ww66Cq3VnCINuJE= github.com/miekg/dns v1.1.66/go.mod h1:jGFzBsSNbJw6z1HYut1RKBKHA9PBdxeHrZG8J+gC2WE= -github.com/mistifyio/go-zfs/v3 v3.0.1 h1:YaoXgBePoMA12+S1u/ddkv+QqxcfiZK4prI6HPnkFiU= -github.com/mistifyio/go-zfs/v3 v3.0.1/go.mod h1:CzVgeB0RvF2EGzQnytKVvVSDwmKJXxkOTUGbNrTja/k= +github.com/mistifyio/go-zfs/v3 v3.1.0 h1:FZaylcg0hjUp27i23VcJJQiuBeAZjrC8lPqCGM1CopY= +github.com/mistifyio/go-zfs/v3 v3.1.0/go.mod h1:CzVgeB0RvF2EGzQnytKVvVSDwmKJXxkOTUGbNrTja/k= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= diff --git a/vendor/github.com/mistifyio/go-zfs/v3/utils.go b/vendor/github.com/mistifyio/go-zfs/v3/utils.go index b69942b530..8e49be39ff 100644 --- a/vendor/github.com/mistifyio/go-zfs/v3/utils.go +++ b/vendor/github.com/mistifyio/go-zfs/v3/utils.go @@ -2,6 +2,7 @@ package zfs import ( "bytes" + "context" "errors" "fmt" "io" @@ -10,10 +11,37 @@ import ( "runtime" "strconv" "strings" + "sync/atomic" + "syscall" + "time" "github.com/google/uuid" ) +// Runner specifies the parameters used when executing ZFS commands. +type Runner struct { + // Timeout specifies how long to wait before sending a SIGTERM signal to the running process. + Timeout time.Duration + + // Grace specifies the time waited after signaling the running process with SIGTERM before it is forcefully + // killed with SIGKILL. + Grace time.Duration +} + +var defaultRunner atomic.Value + +func init() { + defaultRunner.Store(&Runner{}) +} + +func Default() *Runner { + return defaultRunner.Load().(*Runner) //nolint: forcetypeassert // Impossible for it to be anything else. +} + +func SetRunner(runner *Runner) { + defaultRunner.Store(runner) +} + type command struct { Command string Stdin io.Reader @@ -21,7 +49,19 @@ type command struct { } func (c *command) Run(arg ...string) ([][]string, error) { - cmd := exec.Command(c.Command, arg...) + var cmd *exec.Cmd + if Default().Timeout == 0 { + cmd = exec.Command(c.Command, arg...) + } else { + ctx, cancel := context.WithTimeout(context.Background(), Default().Timeout) + defer cancel() + + cmd = exec.CommandContext(ctx, c.Command, arg...) + cmd.Cancel = func() error { + return cmd.Process.Signal(syscall.SIGTERM) + } + cmd.WaitDelay = Default().Grace + } var stdout, stderr bytes.Buffer diff --git a/vendor/modules.txt b/vendor/modules.txt index f5cc54273e..b1642d0f33 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -826,7 +826,7 @@ github.com/klauspost/compress/zstd/internal/xxhash # github.com/miekg/dns v1.1.66 ## explicit; go 1.23.0 github.com/miekg/dns -# github.com/mistifyio/go-zfs/v3 v3.0.1 +# github.com/mistifyio/go-zfs/v3 v3.1.0 ## explicit; go 1.14 github.com/mistifyio/go-zfs/v3 # github.com/mitchellh/copystructure v1.2.0