If one updates with sudo mw update
When trying to run mw version I get
panic: open /home/adam/.mwcli/.events: permission denied goroutine 1 [running]: gitlab.wikimedia.org/repos/releng/cli/internal/util/files.AddLine(0xc0001806e0, 0xa5, 0xc00058b560, 0x19) /builds/repos/releng/cli/internal/util/files/files.go:40 +0x1a6 gitlab.wikimedia.org/repos/releng/cli/internal/eventlogging.AddEventToStore(0xc00007d500) /builds/repos/releng/cli/internal/eventlogging/root.go:34 +0x107 gitlab.wikimedia.org/repos/releng/cli/internal/eventlogging.AddCommandRunEvent(0xc000819743, 0x7, 0x1542288, 0x6) /builds/repos/releng/cli/internal/eventlogging/root.go:21 +0x294 gitlab.wikimedia.org/repos/releng/cli/cmd.NewMwCliCmd.func1(0xc000822c80, 0x1c60538, 0x0, 0x0) /builds/repos/releng/cli/cmd/root.go:59 +0x12e github.com/spf13/cobra.(*Command).execute(0xc000822c80, 0x1c60538, 0x0, 0x0, 0xc000822c80, 0x1c60538) /go/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:840 +0x231 github.com/spf13/cobra.(*Command).ExecuteC(0xc000595400, 0x6, 0xc00058e790, 0x3) /go/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:974 +0x375 github.com/spf13/cobra.(*Command).Execute(...) /go/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:902 gitlab.wikimedia.org/repos/releng/cli/cmd.Execute(0x1543050, 0x7, 0x1542278, 0x4, 0x1542280, 0x5, 0x1543058, 0x7, 0x1546090, 0x14, ...) /builds/repos/releng/cli/cmd/root.go:204 +0x377 main.main() /builds/repos/releng/cli/main.go:29 +0xb5
This is due to the fact that the .events file was created as root when the sudo was running.
We should avoid this.
If anyone comes across this then they need to sudo chown $(whoami):$(whoami) ~/.mwcli/.events