k0sproject / k0sctl

A bootstrapping and management tool for k0s clusters.
Other
391 stars 77 forks source link

ansi color panic on Windows when using busybox sh #752

Open doctorpangloss opened 2 months ago

doctorpangloss commented 2 months ago
INFO ==> Running phase: Download k0s on hosts
[36mINFO[36mINFOpanic: runtime error: slice bounds out of range [1:0]

goroutine 655 [running]:
github.com/shiena/ansicolor.(*ansiColorWriter).Write(0xc0003dc2a0, {0xc00019f180, 0x41, 0x80})
        github.com/shiena/ansicolor@v0.0.0-20230509054315-a9deabde6e02/ansicolor_windows.go:385 +0x45b
github.com/k0sproject/k0sctl/cmd.(*loghook).Fire(0xc0003b0cc0, 0xc000947a18?)
        github.com/k0sproject/k0sctl/cmd/flags.go:374 +0xb3
github.com/sirupsen/logrus.LevelHooks.Fire(0xc000947a58?, 0x947a18?, 0xc0003aa150)
        github.com/sirupsen/logrus@v1.9.3/hooks.go:28 +0x64
github.com/sirupsen/logrus.(*Entry).fireHooks(0xc0003aa150)
        github.com/sirupsen/logrus@v1.9.3/entry.go:280 +0x1fa
github.com/sirupsen/logrus.(*Entry).log(0xc0003aa000, 0x4, {0xc000a8ea40, 0x31})
        github.com/sirupsen/logrus@v1.9.3/entry.go:242 +0x399
github.com/sirupsen/logrus.(*Entry).Log(0xc0003aa000, 0x4, {0xc000947c18?, 0x2?, 0x2?})
        github.com/sirupsen/logrus@v1.9.3/entry.go:304 +0x48
github.com/sirupsen/logrus.(*Entry).Logf(0xc0003aa000, 0x4, {0xd30780?, 0x12?}, {0xc000947dd8?, 0x5?, 0xc00090e480?})
        github.com/sirupsen/logrus@v1.9.3/entry.go:349 +0x7c
github.com/sirupsen/logrus.(*Logger).Logf(0x1502e80, 0x4, {0xd30780, 0x16}, {0xc000947dd8, 0x2, 0x2})
        github.com/sirupsen/logrus@v1.9.3/logger.go:154 +0x7c
github.com/sirupsen/logrus.(*Logger).Infof(...)
        github.com/sirupsen/logrus@v1.9.3/logger.go:168
github.com/sirupsen/logrus.Infof(...)
        github.com/sirupsen/logrus@v1.9.3/exported.go:199
github.com/k0sproject/k0sctl/phase.(*DownloadK0s).downloadK0s(0xc0000c6370, 0xc0001ceb48)
        github.com/k0sproject/k0sctl/phase/download_k0s.go:65 +0x174
github.com/k0sproject/k0sctl/pkg/apis/k0sctl.k0sproject.io/v1beta1/cluster.Hosts.ParallelEach.func1(0xc0001ceb48)
        github.com/k0sproject/k0sctl/pkg/apis/k0sctl.k0sproject.io/v1beta1/cluster/hosts.go:124 +0x91
created by github.com/k0sproject/k0sctl/pkg/apis/k0sctl.k0sproject.io/v1beta1/cluster.Hosts.ParallelEach in goroutine 1
        github.com/k0sproject/k0sctl/pkg/apis/k0sctl.k0sproject.io/v1beta1/cluster/hosts.go:122 +0x1bb

is there a way to easily disable console coloring?

doctorpangloss commented 2 months ago

related to https://github.com/rmyorston/busybox-w32/issues/287

BB_SKIP_ANSI_EMULATION=0 ./k0sctl.exe ... resolves the issue

it's from interacting with ssh. but generally I think less coloring and various amenities, the better