Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash in picker when file no longer exists #6183

Closed
rcorre opened this issue Mar 4, 2023 · 2 comments
Closed

Crash in picker when file no longer exists #6183

rcorre opened this issue Mar 4, 2023 · 2 comments
Labels
A-language-server Area: Language server client C-bug Category: This is a bug

Comments

@rcorre
Copy link
Contributor

rcorre commented Mar 4, 2023

Summary

I was working on a cpp project, and my compile_commands.json was out of date.
Searching for symbols in the workspace symbol picker caused a crash.

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Line index out of bounds: line index 2447, Rope/RopeSlice line count 2', /home/rcorre/.cargo/registry/src/github.com-1ecc6299db9ec823/ropey-1.6.0/src/rope.rs:764:41
stack backtrace:
   0: rust_begin_unwind
             at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/std/src/panicking.rs:575:5
   1: core::panicking::panic_fmt
             at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/core/src/panicking.rs:64:14
   2: core::result::unwrap_failed
             at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/core/src/result.rs:1791:5
   3: core::result::Result<T,E>::unwrap
             at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/core/src/result.rs:1113:23
   4: ropey::rope::Rope::line_to_char
             at /home/rcorre/.cargo/registry/src/github.com-1ecc6299db9ec823/ropey-1.6.0/src/rope.rs:764:9
   5: <helix_term::ui::picker::FilePicker<T> as helix_term::compositor::Component>::render
             at /home/rcorre/src/helix/helix-term/src/ui/picker.rs:298:25
   6: <helix_term::ui::picker::DynamicPicker<T> as helix_term::compositor::Component>::render
             at /home/rcorre/src/helix/helix-term/src/ui/picker.rs:909:9
   7: <helix_term::ui::overlay::Overlay<T> as helix_term::compositor::Component>::render
             at /home/rcorre/src/helix/helix-term/src/ui/overlay.rs:48:9
   8: helix_term::compositor::Compositor::render
             at /home/rcorre/src/helix/helix-term/src/compositor.rs:170:13
   9: helix_term::application::Application::render::{{closure}}
             at /home/rcorre/src/helix/helix-term/src/application.rs:307:9
  10: helix_term::application::Application::event_loop_until_idle::{{closure}}
             at /home/rcorre/src/helix/helix-term/src/application.rs:352:34
  11: helix_term::application::Application::event_loop::{{closure}}
             at /home/rcorre/src/helix/helix-term/src/application.rs:324:57
  12: helix_term::application::Application::run::{{closure}}
             at /home/rcorre/src/helix/helix-term/src/application.rs:1084:38
  13: hx::main_impl::{{closure}}
             at /home/rcorre/src/helix/helix-term/src/main.rs:156:53
  14: tokio::runtime::park::CachedParkThread::block_on::{{closure}}
             at /home/rcorre/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.25.0/src/runtime/park.rs:283:63
  15: tokio::runtime::coop::with_budget
             at /home/rcorre/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.25.0/src/runtime/coop.rs:102:5
  16: tokio::runtime::coop::budget
             at /home/rcorre/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.25.0/src/runtime/coop.rs:68:5
  17: tokio::runtime::park::CachedParkThread::block_on
             at /home/rcorre/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.25.0/src/runtime/park.rs:283:31
  18: tokio::runtime::context::BlockingRegionGuard::block_on
             at /home/rcorre/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.25.0/src/runtime/context.rs:315:13
  19: tokio::runtime::scheduler::multi_thread::MultiThread::block_on
             at /home/rcorre/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.25.0/src/runtime/scheduler/multi_thread/mod.rs:66:9
  20: tokio::runtime::runtime::Runtime::block_on
             at /home/rcorre/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.25.0/src/runtime/runtime.rs:284:45
  21: hx::main_impl
             at /home/rcorre/src/helix/helix-term/src/main.rs:158:5
  22: hx::main
             at /home/rcorre/src/helix/helix-term/src/main.rs:38:21
  23: core::ops::function::FnOnce::call_once
             at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/core/src/ops/function.rs:507:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Reproduction Steps

I tried this:

  1. cd ~/src/godot
  2. git checkout 3.5.1-stable
  3. scons compiledb=true compile_commands.json
  4. git checkout 4.0.2-stable
  5. hx editor/project_converter_3_to_4.cpp
  6. /\.find
  7. gd -- takes me to an empty buffer, because it can't find String::find due to the old compiledb, the file moved
  8. <space>Sfind

Helix log

~/.cache/helix/helix.log
please provide a copy of `~/.cache/helix/helix.log` here if possible, you may need to redact some of the lines

helix.log

Platform

Linux

Terminal Emulator

st 0.8.5

Helix Version

22.12-294-g6494fc1d

@kirawi kirawi added C-bug Category: This is a bug A-language-server Area: Language server client labels Mar 9, 2023
@rcorre rcorre changed the title Crash in workspace symbol picker with old compiledb and clangd Crash in picker when file no longer exists Mar 27, 2023
@rcorre
Copy link
Contributor Author

rcorre commented Mar 27, 2023

I've updated the description. This doesn't appear to be limited to the symbol picker. I just hit it with the global search picker, by suspending helix, switching to a distant branch, resuming helix, and hitting a search on a changed file:

  • git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
  • cd linux
  • git checkout v4.18
  • RUST_BACKTRACE=1 hx
  • <space>/ search for "SYSCALL_DEFINE.*exec"
  • Select fs/exec.c on the line "COMPAT_SYSCALL_DEFINE3(execve, const char __user *, filename,"
  • ctrl+z
  • git checkout v5.14
  • fg
  • <space>/<cr> (repeat last global search)
  • ctrl+p to select fs/exec.c again
  • crash
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Line index out of bounds: line index 2062, Rope/RopeSlice line count 1998', /home/rrc/.cargo/registry/src/github.com-1ecc6299db9ec823/ropey-1.6.0/src/rope.rs:764:41
stack backtrace:
   0: rust_begin_unwind
             at /build/rustc-8kCV4J/rustc-1.61.0+dfsg1~llvm/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /build/rustc-8kCV4J/rustc-1.61.0+dfsg1~llvm/library/core/src/panicking.rs:143:14
   2: core::result::unwrap_failed
             at /build/rustc-8kCV4J/rustc-1.61.0+dfsg1~llvm/library/core/src/result.rs:1785:5
   3: ropey::rope::Rope::line_to_char
   4: <helix_term::ui::picker::FilePicker<T> as helix_term::compositor::Component>::render
   5: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
   6: helix_term::application::Application::run::{{closure}}
   7: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
   8: tokio::runtime::park::CachedParkThread::block_on
   9: tokio::runtime::scheduler::multi_thread::MultiThread::block_on
  10: hx::main

@pascalkuthe
Copy link
Member

This was fixed by #5639

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-language-server Area: Language server client C-bug Category: This is a bug
Projects
None yet
Development

No branches or pull requests

3 participants