gravitl / netmaker

Netmaker makes networks with WireGuard. Netmaker automates fast, secure, and distributed virtual networks.
https://netmaker.io
Other
9.4k stars 547 forks source link

segfault prints developers home direcory #534

Closed carebare47 closed 2 years ago

carebare47 commented 2 years ago

Hi all,

Sometimes when I run curl -sfL https://raw.githubusercontent.com/gravitl/netmaker/master/scripts/netclient-install.sh | VERSION=v0.9.1 KEY=<KEY> sh - without first running rm -r /etc/netclient, I get a segfault and the following stacktrace:

...
2021/12/06 18:12:43 [netclient] error installing: stat /etc/netclient/config: not a directory
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x8a243c]

goroutine 1 [running]:
github.com/gravitl/netmaker/netclient/config.FileExists({0xc0000ce940, 0x9c6002})
    /home/alex/netmaker/netclient/config/config.go:407 +0x5c
github.com/gravitl/netmaker/netclient/config.ReplaceWithBackup({0xc00020cb00, 0xb})
    /home/alex/netmaker/netclient/config/config.go:238 +0xad
github.com/gravitl/netmaker/netclient/config.ReadConfig({0xc00020cb00, 0xc0000266f0})
    /home/alex/netmaker/netclient/config/config.go:378 +0xe5
github.com/gravitl/netmaker/netclient/functions.LeaveNetwork({0xc00020cb00, 0xb})
    /home/alex/netmaker/netclient/functions/common.go:171 +0x58
github.com/gravitl/netmaker/netclient/command.Join({{{0xc00020cae0, 0xe}, {0xc000024820, 0x1b}, {0xc000024800, 0x1a}, {0xc00020cb10, 0x10}, {0xc00020cafa, 0x2}, ...}, ...}, ...)
    /home/alex/netmaker/netclient/command/commands.go:33 +0x113
main.main.func1(0xc000076c00)
    /home/alex/netmaker/netclient/main.go:242 +0x177
github.com/urfave/cli/v2.(*Command).Run(0xc0001857a0, 0xc00001efc0)
    /home/alex/go/pkg/mod/github.com/urfave/cli/v2@v2.3.0/command.go:163 +0x64a
github.com/urfave/cli/v2.(*App).RunContext(0xc0000cd380, {0xa7d570, 0xc0000220e0}, {0xc00001e080, 0x4, 0x4})
    /home/alex/go/pkg/mod/github.com/urfave/cli/v2@v2.3.0/app.go:313 +0x81e
github.com/urfave/cli/v2.(*App).Run(...)
    /home/alex/go/pkg/mod/github.com/urfave/cli/v2@v2.3.0/app.go:224
main.main()
    /home/alex/netmaker/netclient/main.go:383 +0x2ab6

Looks like references to a developers home directory?

Removing /etc/netmaker before running the installer fixes the issue for me, just thought you should know about this stacktrace

afeiszli commented 2 years ago

Will fix this in builds for 0.9.2.

afeiszli commented 2 years ago

fixed in 0.9.2