From 177a0c1ca90cc7d2eceb064be23ba167550d4375 Mon Sep 17 00:00:00 2001 From: Dmytro Kozlov Date: Thu, 13 Jul 2023 17:11:48 +0200 Subject: [PATCH] app/vmctl: fix issue with adding many seconds (#4617) * app/vmctl: fix issue with adding many seconds * app/vmagent: add CHANGELOG.md --- docs/CHANGELOG.md | 1 + go.mod | 2 +- go.sum | 4 ++-- vendor/github.com/cheggaaa/pb/v3/pool_win.go | 9 +++++++-- vendor/github.com/cheggaaa/pb/v3/pool_x.go | 8 +++++++- vendor/modules.txt | 2 +- 6 files changed, 19 insertions(+), 7 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 0fc9e5bb6..f9c53f2cf 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -51,6 +51,7 @@ The following tip changes can be tested by building VictoriaMetrics components f * BUGFIX: [vmui](https://docs.victoriametrics.com/#vmui): fix application routing issues and problems with manual URL changes. See [this pull request](https://github.com/VictoriaMetrics/VictoriaMetrics/pull/4408). * BUGFIX: add validation for invalid [partial RFC3339 timestamp formats](https://docs.victoriametrics.com/Single-server-VictoriaMetrics.html#timestamp-formats) in query and export APIs. * BUGFIX: [vmctl](https://docs.victoriametrics.com/vmctl.html): interrupt explore procedure in influx mode if vmctl found no numeric fields. +* BUGFIX: [vmctl](https://docs.victoriametrics.com/vmctl.html): fix issue with adding additional character if length of the if the length of the string has become less than the previous length. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4555). * BUGFIX: [vmalert](https://docs.victoriametrics.com/vmalert.html): use RFC3339 time format in query args instead of unix timestamp for all issued queries to Prometheus-like datasources. * BUGFIX: [vmalert](https://docs.victoriametrics.com/vmalert.html): correctly calculate evaluation time for rules. Before, there was a low probability for discrepancy between actual time and rules evaluation time if evaluation interval was lower than the execution time for rules within the group. * BUGFIX: vmselect: fix timestamp alignment for Prometheus querying API if time argument is less than 10m from the beginning of Unix epoch. diff --git a/go.mod b/go.mod index 43208fc07..7adc532da 100644 --- a/go.mod +++ b/go.mod @@ -18,7 +18,7 @@ require ( github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.71 github.com/aws/aws-sdk-go-v2/service/s3 v1.36.0 github.com/cespare/xxhash/v2 v2.2.0 - github.com/cheggaaa/pb/v3 v3.1.2 + github.com/cheggaaa/pb/v3 v3.1.3 github.com/gogo/protobuf v1.3.2 github.com/golang/snappy v0.0.4 github.com/googleapis/gax-go/v2 v2.12.0 diff --git a/go.sum b/go.sum index 2db442916..b0047ee5d 100644 --- a/go.sum +++ b/go.sum @@ -138,8 +138,8 @@ github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cheggaaa/pb/v3 v3.1.2 h1:FIxT3ZjOj9XJl0U4o2XbEhjFfZl7jCVCDOGq1ZAB7wQ= -github.com/cheggaaa/pb/v3 v3.1.2/go.mod h1:SNjnd0yKcW+kw0brSusraeDd5Bf1zBfxAzTL2ss3yQ4= +github.com/cheggaaa/pb/v3 v3.1.3 h1:U4qwn3RWfzalArfx3mClzUaV/9NUOtC60PlyNa98I+0= +github.com/cheggaaa/pb/v3 v3.1.3/go.mod h1:6wVjILNBaXMs8c21qRiaUM8BR82erfgau1DQ4iUXmSA= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= diff --git a/vendor/github.com/cheggaaa/pb/v3/pool_win.go b/vendor/github.com/cheggaaa/pb/v3/pool_win.go index 35a61474a..954bf8f56 100644 --- a/vendor/github.com/cheggaaa/pb/v3/pool_win.go +++ b/vendor/github.com/cheggaaa/pb/v3/pool_win.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package pb @@ -24,7 +25,7 @@ func (p *Pool) print(first bool) bool { } coords.X = 0 - err = termutil.SetCursorPos(coords) + err = termutil.SetCursorPos(coords) if err != nil { log.Panic(err) } @@ -34,7 +35,11 @@ func (p *Pool) print(first bool) bool { if !bar.IsFinished() { isFinished = false } - out += fmt.Sprintf("\r%s\n", bar.String()) + result := bar.String() + if r := cols - CellCount(result); r > 0 { + result += strings.Repeat(" ", r) + } + out += fmt.Sprintf("\r%s\n", result) } if p.Output != nil { fmt.Fprint(p.Output, out) diff --git a/vendor/github.com/cheggaaa/pb/v3/pool_x.go b/vendor/github.com/cheggaaa/pb/v3/pool_x.go index 435030155..cae975838 100644 --- a/vendor/github.com/cheggaaa/pb/v3/pool_x.go +++ b/vendor/github.com/cheggaaa/pb/v3/pool_x.go @@ -1,3 +1,4 @@ +//go:build linux || darwin || freebsd || netbsd || openbsd || solaris || dragonfly || plan9 || aix // +build linux darwin freebsd netbsd openbsd solaris dragonfly plan9 aix package pb @@ -5,6 +6,7 @@ package pb import ( "fmt" "os" + "strings" "github.com/cheggaaa/pb/v3/termutil" ) @@ -31,7 +33,11 @@ func (p *Pool) print(first bool) bool { isFinished = false } bar.SetWidth(cols) - out += fmt.Sprintf("\r%s\n", bar.String()) + result := bar.String() + if r := cols - CellCount(result); r > 0 { + result += strings.Repeat(" ", r) + } + out += fmt.Sprintf("\r%s\n", result) } if p.Output != nil { fmt.Fprint(p.Output, out) diff --git a/vendor/modules.txt b/vendor/modules.txt index cf2e347c0..42e84c0f1 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -277,7 +277,7 @@ github.com/bmatcuk/doublestar/v4 # github.com/cespare/xxhash/v2 v2.2.0 ## explicit; go 1.11 github.com/cespare/xxhash/v2 -# github.com/cheggaaa/pb/v3 v3.1.2 +# github.com/cheggaaa/pb/v3 v3.1.3 ## explicit; go 1.17 github.com/cheggaaa/pb/v3 github.com/cheggaaa/pb/v3/termutil