From c3f7733f5311f92a32dcd81244f894663f8f6e13 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Mon, 8 Jun 2020 10:32:34 -0700 Subject: [PATCH] logpolicy: don't check version.CmdName on Windows unnecessarily ... it was crashing for some reason, running out of stack while loading a DLL in goversion. I don't understand Windows (or the Go runtime for Windows) enough to know why that'd be problematic in that context. In any case, don't call it, as tryFixLogStateLocation does nothing on Windows anyway. tryFixLogStateLocation should probably just call version.CmdName itself if/when it needs to, after the GOOS check. --- logpolicy/logpolicy.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/logpolicy/logpolicy.go b/logpolicy/logpolicy.go index a63046613..370eeca02 100644 --- a/logpolicy/logpolicy.go +++ b/logpolicy/logpolicy.go @@ -305,7 +305,9 @@ func New(collection string) *Policy { dir := logsDir() - tryFixLogStateLocation(dir, version.CmdName()) + if runtime.GOOS != "windows" { // version.CmdName call was blowing some Windows stack limit via goversion DLL loading + tryFixLogStateLocation(dir, version.CmdName()) + } cfgPath := filepath.Join(dir, fmt.Sprintf("%s.log.conf", version.CmdName())) var oldc *Config