Panic on empty fcc
- Dominant language
- Go
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
```
$ ls -l test.fcc
-rw-rw-r--. 1 rbost rbost 0 Aug 22 16:31 test.fcc
$ ../fccb add user test.fcc -n core
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0xf0 pc=0x88ba56]
goroutine 1 [running]:
github.com/bostrt/fccb/pkg/passwd.(*FccbUser).Add(...)
/home/rbost/go/src/github.com/bostrt/fccb/pkg/passwd/user.go:47
github.com/bostrt/fccb/cmd.glob..func6(0xd8f7a0, 0xc000183800, 0x1, 0x3)
/home/rbost/go/src/github.com/bostrt/fccb/cmd/user.go:78 +0x676
github.com/spf13/cobra.(*Command).execute(0xd8f7a0, 0xc0001837d0, 0x3, 0x3, 0xd8f7a0, 0xc0001837d0)
/home/rbost/go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:846 +0x29d
github.com/spf13/cobra.(*Command).ExecuteC(0xd904c0, 0x443aaa, 0xd4eee0, 0xc000000180)
/home/rbost/go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:950 +0x349
github.com/spf13/cobra.(*Command).Execute(...)
/home/rbost/go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:887
github.com/bostrt/fccb/cmd.Execute()
/home/rbost/go/src/github.com/bostrt/fccb/cmd/root.go:47 +0x31
main.main()
/home/rbost/go/src/github.com/bostrt/fccb/main.go:21 +0x20
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the panic with an empty test.fcc using the ../fccb add user test.fcc -n core command. Start at pkg/passwd/user.go:47 and follow the call from cmd/user.go:78; done means the command no longer crashes with a nil pointer dereference.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 25/100