pkg config panics sometimes when indexing over a path
fchikwekwe opened this issue · comments
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