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

panicked at 'assertion failed: self.is_char_boundary(n)' #3157

Closed
aikomastboom opened this issue Jul 22, 2022 · 1 comment · Fixed by #3193
Closed

panicked at 'assertion failed: self.is_char_boundary(n)' #3157

aikomastboom opened this issue Jul 22, 2022 · 1 comment · Fixed by #3193
Labels
A-helix-term Area: Helix term improvements C-bug Category: This is a bug

Comments

@aikomastboom
Copy link
Contributor

Summary

Helix crashes from command completion menu.

Reproduction Steps

asciicast

I tried this:

  1. hx
  2. :tutor [Enter]
  3. :theme def [Tab]
  4. [arrow UP]
  5. [Tab]
  6. ... PANIC

NOTE: no [Enter] at step 3.

I expected this to happen:
nothing... or the normal completions for when tutor is current.

Instead, this happened:
crash to prompt.

Helix log

RUST_STACKTRACE=full
thread 'main' panicked at 'assertion failed: self.is_char_boundary(n)', /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/alloc/src/string.rs:1725:29
stack backtrace:
   0:        0x10bf8c9c4 - std::backtrace_rs::backtrace::libunwind::trace::h3cae2b905fd8ac13
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:        0x10bf8c9c4 - std::backtrace_rs::backtrace::trace_unsynchronized::he35fb4c47e25f88c
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:        0x10bf8c9c4 - std::sys_common::backtrace::_print_fmt::hdb42afc2298dc41a
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/sys_common/backtrace.rs:66:5
   3:        0x10bf8c9c4 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hc80096156cd24709
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/sys_common/backtrace.rs:45:22
   4:        0x10bfad44b - core::fmt::write::hb6b947db0e571766
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/fmt/mod.rs:1194:17
   5:        0x10bf863e8 - std::io::Write::write_fmt::h59c4febf5f8fcb1e
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/io/mod.rs:1655:15
   6:        0x10bf8eb5d - std::sys_common::backtrace::_print::h72a3180302df7468
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/sys_common/backtrace.rs:48:5
   7:        0x10bf8eb5d - std::sys_common::backtrace::print::ha0747cec3f48ad89
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/sys_common/backtrace.rs:35:9
   8:        0x10bf8eb5d - std::panicking::default_hook::{{closure}}::h0e76f92bbb367061
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:295:22
   9:        0x10bf8e841 - std::panicking::default_hook::hbbbb8c05ad6cce9a
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:314:9
  10:        0x10ab86e84 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h5d2d9de8e496e02b
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/alloc/src/boxed.rs:1875:9
  11:        0x10ab6dfca - helix_term::application::Application::run::{{closure}}::{{closure}}::h5a57cce3e32925d7
                               at /Users/aiko/Development/helix/helix-term/src/application.rs:815:13
  12:        0x10bf8f196 - std::panicking::rust_panic_with_hook::ha581a2c99399f83b
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:702:17
  13:        0x10bf8ef9a - std::panicking::begin_panic_handler::{{closure}}::h97df6e4273b6a879
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:586:13
  14:        0x10bf8ce47 - std::sys_common::backtrace::__rust_end_short_backtrace::ha4a3b48ae6bfb343
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/sys_common/backtrace.rs:138:18
  15:        0x10bf8ecaa - rust_begin_unwind
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:584:5
  16:        0x10bfee703 - core::panicking::panic_fmt::h4a5343602e6cbb54
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/panicking.rs:143:14
  17:        0x10bfee5e7 - core::panicking::panic::h6b179fc6a750c6a7
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/panicking.rs:48:5
  18:        0x10b056f44 - alloc::string::String::replace_range::h80f5fcb53a15be72
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/alloc/src/string.rs:1725:29
  19:        0x10aec1680 - helix_term::ui::prompt::Prompt::change_completion_selection::hcb1115da8d576dea
                               at /Users/aiko/Development/helix/helix-term/src/ui/prompt.rs:334:9
  20:        0x10aec36ed - <helix_term::ui::prompt::Prompt as helix_term::compositor::Component>::handle_event::h513a71542717ae1e
                               at /Users/aiko/Development/helix/helix-term/src/ui/prompt.rs:564:17
  21:        0x10ad6128b - helix_term::compositor::Compositor::handle_event::h999832d89f585175
                               at /Users/aiko/Development/helix/helix-term/src/compositor.rs:173:19
  22:        0x10ad7f88a - helix_term::application::Application::handle_terminal_events::h68616e98e85fcc18
                               at /Users/aiko/Development/helix/helix-term/src/application.rs:435:26
  23:        0x10ab67cc9 - helix_term::application::Application::event_loop_until_idle::{{closure}}::hdb215bb5bbf1aa17
                               at /Users/aiko/Development/helix/helix-term/src/application.rs:273:21
  24:        0x10ab955b0 - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::hd14b3d1db2c14448
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/future/mod.rs:91:19
  25:        0x10ab66735 - helix_term::application::Application::event_loop::{{closure}}::h5f15900b0b92511d
                               at /Users/aiko/Development/helix/helix-term/src/application.rs:249:57
  26:        0x10ab948c0 - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h08dafeca780e328b
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/future/mod.rs:91:19
  27:        0x10ab6db91 - helix_term::application::Application::run::{{closure}}::hcb66d904ea7d9507
                               at /Users/aiko/Development/helix/helix-term/src/application.rs:818:38
  28:        0x10ab953c0 - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h951d233b9405323c
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/future/mod.rs:91:19
  29:        0x10ab6057d - hx::main_impl::{{closure}}::haa1f67214714a10b
                               at /Users/aiko/Development/helix/helix-term/src/main.rs:140:53
  30:        0x10ab94cb0 - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h50efb5df125c0b61
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/future/mod.rs:91:19
  31:        0x10ab91941 - tokio::park::thread::CachedParkThread::block_on::{{closure}}::h3860f43bc77f7288
                               at /Users/aiko/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/tokio-1.19.2/src/park/thread.rs:263:54
  32:        0x10ab8c858 - tokio::coop::with_budget::{{closure}}::h5e048a9d973b76e4
                               at /Users/aiko/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/tokio-1.19.2/src/coop.rs:102:9
  33:        0x10ab91f0a - std::thread::local::LocalKey<T>::try_with::h0b3b9591a86c56f3
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/thread/local.rs:442:16
  34:        0x10ab91c68 - std::thread::local::LocalKey<T>::with::h500da7966c4ce526
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/thread/local.rs:418:9
  35:        0x10ab9176e - tokio::coop::with_budget::h0bb5bbdb7e7fc6b0
                               at /Users/aiko/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/tokio-1.19.2/src/coop.rs:95:5
  36:        0x10ab9176e - tokio::coop::budget::h1b23056d0646cf9f
                               at /Users/aiko/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/tokio-1.19.2/src/coop.rs:72:5
  37:        0x10ab9176e - tokio::park::thread::CachedParkThread::block_on::h6dcad7c314fcfd03
                               at /Users/aiko/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/tokio-1.19.2/src/park/thread.rs:263:31
  38:        0x10ab3533d - tokio::runtime::enter::Enter::block_on::hb114a06b01f0c7b9
                               at /Users/aiko/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/tokio-1.19.2/src/runtime/enter.rs:151:13
  39:        0x10ab5ecd9 - tokio::runtime::thread_pool::ThreadPool::block_on::hf15ce44b1518a851
                               at /Users/aiko/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/tokio-1.19.2/src/runtime/thread_pool/mod.rs:90:9
  40:        0x10ab5d1e3 - tokio::runtime::Runtime::block_on::hd96bff2e3a851f55
                               at /Users/aiko/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/tokio-1.19.2/src/runtime/mod.rs:482:43
  41:        0x10ab98919 - hx::main_impl::hdd2d19cc45c6760c
                               at /Users/aiko/Development/helix/helix-term/src/main.rs:142:5
  42:        0x10ab98791 - hx::main::h2f2fb0c7202cfbe0
                               at /Users/aiko/Development/helix/helix-term/src/main.rs:37:21
  43:        0x10ab4f4de - core::ops::function::FnOnce::call_once::h410a6daae36970c0
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/ops/function.rs:227:5
  44:        0x10ab353a1 - std::sys_common::backtrace::__rust_begin_short_backtrace::ha42215936cb0f2e4
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/sys_common/backtrace.rs:122:18
  45:        0x10ab54b34 - std::rt::lang_start::{{closure}}::h369caf72faff137b
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/rt.rs:145:18
  46:        0x10bf7f61a - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::h45b43bdd91db95dd
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/ops/function.rs:259:13
  47:        0x10bf7f61a - std::panicking::try::do_call::h249f439f16aa313c
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:492:40
  48:        0x10bf7f61a - std::panicking::try::ha8537a1873fa2ff9
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:456:19
  49:        0x10bf7f61a - std::panic::catch_unwind::hffa61ccaeb4f89c5
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panic.rs:137:14
  50:        0x10bf7f61a - std::rt::lang_start_internal::{{closure}}::h32bbf4c39987b002
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/rt.rs:128:48
  51:        0x10bf7f61a - std::panicking::try::do_call::h558936e01b59417c
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:492:40
  52:        0x10bf7f61a - std::panicking::try::h12a630e8ced1b46a
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:456:19
  53:        0x10bf7f61a - std::panic::catch_unwind::h539ca15d1ec773ea
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panic.rs:137:14
  54:        0x10bf7f61a - std::rt::lang_start_internal::hdb19fe6764e59ca8
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/rt.rs:128:20
  55:        0x10ab54b0e - std::rt::lang_start::h86c36dcc58d8bff8
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/rt.rs:144:17
  56:        0x10ab989a6 - _main

Platform

Linux / macOS

Terminal Emulator

iTerm

Helix Version

commit 19e51c8 (HEAD -> master, helix/master)

@aikomastboom aikomastboom added the C-bug Category: This is a bug label Jul 22, 2022
@kirawi kirawi added the A-helix-term Area: Helix term improvements label Jul 23, 2022
@Frojdholm
Copy link
Contributor

I've managed to reproduce this issue. The problem is caused by the fact that navigating the history is not triggering updates to the completions. Any command in the history that is shorter than the current line completion start (or containing a non-ascii character at the that point) can trigger the crash.

See #3193 for a potential fix.

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

Successfully merging a pull request may close this issue.

3 participants