influxdata / influxdata/pkg-config
pkg config panics sometimes when indexing over a path
- Dominant language
- Go
- Stars
- 4
- Forks
- 8
- PR merge metrics
- No merged PRs in 30d
Description
I got this error when running the debugger via Goland:
```
# pkg-config --cflags -- flux
panic: runtime error: slice bounds out of range [11:10]
goroutine 1 [running]:
main.modifyPath(0xc0001467c0, 0x1e, 0xc000016005, 0xd9)
/Users/faith/go/pkg/mod/github.com/influxdata/pkg-config@v0.2.0/main.go:83 +0x3e0
main.realMain(0x0)
/Users/faith/go/pkg/mod/github.com/influxdata/pkg-config@v0.2.0/main.go:189 +0x383
main.main()
/Users/faith/go/pkg/mod/github.com/influxdata/pkg-config@v0.2.0/main.go:249 +0x26
pkg-config: exit status 2
```
My `$PATH` variable was set as follows:
`PATH=/Users/faith/go/bin:/Users/faith/.cargo/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:/usr/local/MacGPG2/bin:/Users/faith/pkgs/ragel/bin`
@wolffcm suggested that I add an additional directory to the beginning of my `$PATH`, and that seemed to resolve my issue.
@adrian-thurston suggested that we might be hitting this issue due to modifying the split path array while indexing over it here: https://github.com/influxdata/pkg-config/blob/master/main.go#L35-L60
He also suggested that exiting the loop for modifications might help this issue.
pkg-config v0.2.6-0
Goland v2020.3
go v1.14.1
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in main.go at the path-modification logic referenced around lines 35-60, then inspect modifyPath near line 83. Reproduce the panic with the reported PATH and debugger invocation, and verify that path indexing no longer panics when entries are modified during processing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- build-system, cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100