junegunn / fzf

:cherry_blossom: A command-line fuzzy finder
https://junegunn.github.io/fzf/
MIT License
63.78k stars 2.37k forks source link

panic: runtime error: index out of range [-1] with --track option #3681

Closed Kyle0923 closed 6 months ago

Kyle0923 commented 6 months ago

Info

Problem / Steps to reproduce

download the fzf repo using the rg fzf ctrl-T example in ADVANCED.md, let's call it rfv add --track option to the fzf command in the script execute rfv at fzf repo

observed a crash with the following message, the CLI became unusable afterward

1. ripgrep> panic: runtime error: index out of range [-1]

my environment Ubuntu 22.04.4 LTS on a vbox fzf version: latest master - Mar 16, 2024

junegunn commented 6 months ago

Thanks for the report. c7ee071 should fix the problem.

Kyle0923 commented 5 months ago

Dear maintainer,

Thanks for the quick fix. But I was still able to observed the crash by repeatedly run the script a few time (~5 times)

I was able to see the crash on both my Ubuntu 22.04 VM and a Ubutun 20.04 PC.

Error message

1. ripgrep> panic: runtime error: index out of range [-1]
goroutine 1 [running]:
github.com/junegunn/fzf/src.(*Merger).Get(0x0?, 0x0?)
/Users/jg/github/fzf/src/merger.go:106 +0xe9
github.com/junegunn/fzf/src.(*Terminal).UpdateList(0xc0000a4300, 0xc0000ba080)
/Users/jg/github/fzf/src/terminal.go:1063 +0x11a
github.com/junegunn/fzf/src.Run.func12(0xc0000a8660)
/Users/jg/github/fzf/src/core.go:365 +0xbf0
github.com/junegunn/fzf/src/util.(*EventBox).Wait(0xc0000a8660, 0xc000061e90)
/Users/jg/github/fzf/src/util/eventbox.go:34 +0x6c
github.com/junegunn/fzf/src.Run(0xc0000f0380, {0x605a64?, 0x0?}, {0x605ba8?, 0xc000006340?})
/Users/jg/github/fzf/src/core.go:256 +0x13e5
main.main()
/Users/jg/github/fzf/main.go:13 +0x3a
junegunn commented 5 months ago

I think you're still using the old version. What's the output of fzf --version?

Kyle0923 commented 5 months ago

Thanks. I didnot realized after git pull, i need to run the install script. It is good now