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 on outdated entry in file picker #8677

Closed
seanbone opened this issue Oct 31, 2023 · 4 comments
Closed

Crash on outdated entry in file picker #8677

seanbone opened this issue Oct 31, 2023 · 4 comments
Labels
C-bug Category: This is a bug

Comments

@seanbone
Copy link

Summary

I performed a global search for TODO and removed a bunch of TODO items from a file. Upon reopening the previous picker and switching to one of the later entries, Helix crashes.

Pretty sure this is a fairly simple bounds-checking issue; if a picker has a reference to a file line that is no longer valid, it'll cause this crash. See the backtraces attached below.

Reproduction Steps

Steps to reproduce:

  1. hx
  2. Write following contents into a file test.txt:
This
TODO
TODO
is
a
TODO
TODO
test
  1. Perform a global search for TODO: <space>/TODO<enter>
  2. Remove all lines containing TODO in the file: %sTODO<enter>xd (note this removes the entire line for each occurrence)
  3. Reopen previous picker: <space>'
  4. <tab> until the last entry of test.txt
  5. That entry is pointing to a line number that no longer exists in test.txt. Helix panics.

Helix log

Output with `RUST_BACKTRACE=1`
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Line index out of bounds: line index 6, Rope/RopeSlice line count 5', /home/sbone/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ropey-1.6.0/src/rope.rs:764:41
stack backtrace:
   0: rust_begin_unwind
             at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panicking.rs:593:5
   1: core::panicking::panic_fmt
             at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/panicking.rs:67:14
   2: core::result::unwrap_failed
             at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/result.rs:1651:5
   3: <helix_term::ui::picker::Picker<T> as helix_term::compositor::Component>::render
   4: helix_term::application::Application::render::{{closure}}
   5: helix_term::application::Application::run::{{closure}}
   6: tokio::runtime::park::CachedParkThread::block_on
   7: tokio::runtime::context::runtime::enter_runtime
   8: tokio::runtime::runtime::Runtime::block_on
   9: hx::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Output with `RUST_BACKTRACE=full`

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Line index out of bounds: line index 6, Rope/RopeSlice line count 5', /home/sbone/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ropey-1.6.0/src/rope.rs:764:41
stack backtrace:
   0:     0x55a1405c8566 - std::backtrace_rs::backtrace::libunwind::trace::he648b5c8dd376705
                               at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x55a1405c8566 - std::backtrace_rs::backtrace::trace_unsynchronized::h5da3e203eef39e9f
                               at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x55a1405c8566 - std::sys_common::backtrace::_print_fmt::h8d28d3f20588ae4c
                               at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x55a1405c8566 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hd9a5b0c9c6b058c0
                               at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x55a13fb889ff - core::fmt::rt::Argument::fmt::h0afc04119f252b53
                               at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/fmt/rt.rs:138:9
   5:     0x55a13fb889ff - core::fmt::write::h50b1b3e73851a6fe
                               at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/fmt/mod.rs:1094:21
   6:     0x55a1405c4447 - std::io::Write::write_fmt::h184eaf275e4484f0
                               at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/io/mod.rs:1714:15
   7:     0x55a1405c8375 - std::sys_common::backtrace::_print::hf58c3a5a25090e71
                               at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x55a1405c8375 - std::sys_common::backtrace::print::hb9cf0a7c7f077819
                               at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x55a1405c9da3 - std::panicking::default_hook::{{closure}}::h066adb2e3f3e2c07
                               at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panicking.rs:269:22
  10:     0x55a1405c9b64 - std::panicking::default_hook::h277fa2776900ff14
                               at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panicking.rs:288:9
  11:     0x55a1405ca3f6 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h09cad52ea08435f2
                               at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/alloc/src/boxed.rs:2007:9
  12:     0x55a1405ca3f6 - std::panicking::rust_panic_with_hook::hceaf38da6d9db792
                               at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panicking.rs:709:13
  13:     0x55a1405ca1a4 - std::panicking::begin_panic_handler::{{closure}}::h2bce3ed2516af7df
                               at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panicking.rs:597:13
  14:     0x55a1405c8966 - std::sys_common::backtrace::__rust_end_short_backtrace::h090f3faf8f98a395
                               at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/sys_common/backtrace.rs:151:18
  15:     0x55a1405c9f32 - rust_begin_unwind
                               at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panicking.rs:593:5
  16:     0x55a13fab98d3 - core::panicking::panic_fmt::h4ec8274704d163a3
                               at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/panicking.rs:67:14
  17:     0x55a13fab9d73 - core::result::unwrap_failed::h170bc2721a6c6ff2
                               at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/result.rs:1651:5
  18:     0x55a1401f1d57 - <helix_term::ui::picker::Picker<T> as helix_term::compositor::Component>::render::h9a5b0e82fda9a7fe
  19:     0x55a140386394 - helix_term::application::Application::render::{{closure}}::h180720922a51822e
  20:     0x55a140383505 - helix_term::application::Application::run::{{closure}}::h4aa1651a5368c781
  21:     0x55a14039838d - tokio::runtime::park::CachedParkThread::block_on::h583049c5d00a10bd
  22:     0x55a1403c1bd4 - tokio::runtime::context::runtime::enter_runtime::hfe5dc2de52def0fd
  23:     0x55a1403e101d - tokio::runtime::runtime::Runtime::block_on::h862cc3912693b985
  24:     0x55a1403d3d03 - hx::main::h9a300ebbbc175458
  25:     0x55a1403d65e3 - std::sys_common::backtrace::__rust_begin_short_backtrace::h94e374bb75398a13
  26:     0x55a1403d65fd - std::rt::lang_start::{{closure}}::hdc0366bdea1eb207
  27:     0x55a1405bea65 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::h75ba4244a1c7bb54
                               at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/ops/function.rs:284:13
  28:     0x55a1405bea65 - std::panicking::try::do_call::h0a2baa36dea975a1
                               at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panicking.rs:500:40
  29:     0x55a1405bea65 - std::panicking::try::h0e42aa233d4224d4
                               at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panicking.rs:464:19
  30:     0x55a1405bea65 - std::panic::catch_unwind::hefdfd8f482606434
                               at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panic.rs:142:14
  31:     0x55a1405bea65 - std::rt::lang_start_internal::{{closure}}::h457959f0f91da23b
                               at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/rt.rs:148:48
  32:     0x55a1405bea65 - std::panicking::try::do_call::h112cfd1acb38183b
                               at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panicking.rs:500:40
  33:     0x55a1405bea65 - std::panicking::try::ha64f15b20cec18ca
                               at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panicking.rs:464:19
  34:     0x55a1405bea65 - std::panic::catch_unwind::hbacc2b68ee2c119e
                               at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panic.rs:142:14
  35:     0x55a1405bea65 - std::rt::lang_start_internal::h5f408694586c2a05
                               at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/rt.rs:148:20
  36:     0x55a1403d3df5 - main
  37:     0x7f94efc22eb0 - __libc_start_call_main
  38:     0x7f94efc22f60 - __libc_start_main@GLIBC_2.2.5
  39:     0x55a13fb05f15 - <unknown>

Platform

Linux

Terminal Emulator

gnome-terminal

Helix Version

helix 23.05 (40d7e6c)

@seanbone seanbone added the C-bug Category: This is a bug label Oct 31, 2023
@pascalkuthe
Copy link
Member

This should be fixed in the latest release, please test again with the 23.10 release

@the-mikedavis
Copy link
Member

This might be different than the problem fixed in #5639 - it looks from the backtrace like we're panicking in the render function (I assume while rendering the preview)

@seanbone
Copy link
Author

Unfortunately I'm unable to test 23.10 because the AppImage won't launch - I'm stuck on older systems because of other constraints and can't immediately update. Apologies!

@kirawi
Copy link
Member

kirawi commented Apr 5, 2024

Closing since it isn't reproducible by the author. It'll be reopened if someone else experiences this behavior with the recent version.

@kirawi kirawi closed this as completed Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug
Projects
None yet
Development

No branches or pull requests

4 participants