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

Segmentation fault when editing a file under certain conditions #7888

Closed
nikitawootten-nist opened this issue Aug 9, 2023 · 1 comment
Closed
Labels
C-bug Category: This is a bug

Comments

@nikitawootten-nist
Copy link

Summary

Under some conditions editing a file in any way triggers a segmentation fault.

I have not been able to determine the specific conditions this occurs, but it seems to happen when performing any edit operation on markdown or xml files within some directories within a git repository.

The bug seems to happen for some files and not others, but when it occurs it does so consistently on the same file.

Backtrace:

thread 'tokio-runtime-worker' panicked at 'range end index 18446744073709551615 out of range for slice of length 0', /private/tmp/nix-build-helix-23.05.drv-0/helix-23.05-vendor.tar.gz/ropey/src/tree/node_children.rs:312:21
stack backtrace:
   0: _rust_begin_unwind
   1: ca
   2: core::slice::index::slice_end_index_len_fail
   3: ropey::iter::Chunks::new_with_range_at_byte
   4: <ropey::slice::RopeSlice as core::cmp::PartialEq<ropey::slice::RopeSlice>>::eq
   5: imara_diff::intern::Interner<T>::intern
   6: <alloc::vec::Vec<T,A> as alloc::vec::spec_extend::SpecExtend<T,I>>::spec_extend
   7: helix_vcs::diff::line_cache::InternedRopeLines::update_doc
   8: tokio::runtime::context::exit_runtime
   9: tokio::runtime::scheduler::multi_thread::worker::block_in_place
  10: helix_vcs::diff::worker::DiffWorker::run::{{closure}}
  11: tokio::loom::std::unsafe_cell::UnsafeCell<T>::with_mut
  12: tokio::runtime::task::core::Core<T,S>::poll
  13: tokio::runtime::task::harness::Harness<T,S>::poll
  14: tokio::runtime::scheduler::multi_thread::worker::Context::run_task
  15: tokio::runtime::scheduler::multi_thread::worker::Context::run
  16: tokio::macros::scoped_tls::ScopedKey<T>::set
  17: tokio::runtime::scheduler::multi_thread::worker::run
  18: tokio::runtime::task::core::Core<T,S>::poll
  19: tokio::runtime::task::harness::Harness<T,S>::poll
  20: tokio::runtime::blocking::pool::Inner::run
note: Some detai[+]are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.                                                                                              2

Reproduction Steps

asciinema.org recording: https://asciinema.org/a/D2Tn53wJQiOymRqeCApSjiA93

  1. Open certain files (some markdown and xml files trigger it)
  2. Upon performing any edit command (e.g. go into insert mode, append a character, or delete a selection) a segmentation fault happens

Helix log

~/.cache/helix/helix.log
2023-08-09T13:54:39.316 helix_view::clipboard [DEBUG] Using pbcopy+pbpaste to interact with the system clipboard
2023-08-09T13:54:39.342 helix_view::editor [ERROR] Failed to initialize the LSP for `source.md` { cannot find binary path }
2023-08-09T13:54:39.342 helix_view::editor [DEBUG] editor status: Loaded 1 file.
2023-08-09T13:54:39.349 helix_tui::backend::crossterm [DEBUG] The keyboard enhancement protocol is not supported in this terminal (checked in 7.110833ms)
2023-08-09T13:54:39.350 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-08-09T13:54:39.719 helix_term::application [DEBUG] received editor event: IdleTimer
2023-08-09T13:54:40.332 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-08-09T13:54:40.733 helix_term::application [DEBUG] received editor event: IdleTimer
2023-08-09T13:54:40.736 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-08-09T13:54:41.687 helix_vcs::diff::worker [INFO] Diff computation timed out, update of diffs might appear delayed
2023-08-09T13:54:41.688 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-08-09T13:54:42.076 helix_term::application [DEBUG] received editor event: IdleTimer
2023-08-09T13:54:42.078 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-08-09T13:54:50.955 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 1
2023-08-09T13:54:50.956 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 1
2023-08-09T13:54:50.956 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 1
2023-08-09T13:54:50.957 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 1
2023-08-09T13:54:50.957 helix_term::commands::typed [DEBUG] quitting...
2023-08-09T13:54:50.958 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 1
2023-08-09T13:54:50.959 helix_term::commands::typed [DEBUG] quitting...
2023-08-09T13:54:50.959 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 1
2023-08-09T13:54:50.959 helix_view::editor [ERROR] editor error: 1 unsaved buffer(s) remaining: ["USERS.md"]
2023-08-09T13:54:50.959 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 1
2023-08-09T13:54:50.960 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 1
2023-08-09T13:54:51.358 helix_term::application [DEBUG] received editor event: IdleTimer
2023-08-09T13:54:52.607 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 1
2023-08-09T13:54:52.607 helix_term::commands::typed [DEBUG] quitting...
2023-08-09T13:54:52.608 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 1
2023-08-09T13:54:52.608 helix_term::commands::typed [DEBUG] quitting...
2023-08-09T13:54:52.608 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 1
2023-08-09T13:54:52.608 helix_view::editor [ERROR] editor error: 1 unsaved buffer(s) remaining: ["USERS.md"]
2023-08-09T13:54:52.609 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 1
2023-08-09T13:54:53.008 helix_term::application [DEBUG] received editor event: IdleTimer
2023-08-09T13:55:06.139 helix_view::clipboard [DEBUG] Using pbcopy+pbpaste to interact with the system clipboard
2023-08-09T13:55:06.164 helix_view::editor [ERROR] Failed to initialize the LSP for `source.md` { cannot find binary path }
2023-08-09T13:55:06.164 helix_view::editor [DEBUG] editor status: Loaded 1 file.
2023-08-09T13:55:06.172 helix_tui::backend::crossterm [DEBUG] The keyboard enhancement protocol is not supported in this terminal (checked in 7.894375ms)
2023-08-09T13:55:06.172 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-08-09T13:55:06.541 helix_term::application [DEBUG] received editor event: IdleTimer
2023-08-09T13:55:07.562 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-08-09T13:55:07.962 helix_term::application [DEBUG] received editor event: IdleTimer
2023-08-09T13:55:07.965 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-08-09T13:55:08.520 helix_vcs::diff::worker [INFO] Diff computation timed out, update of diffs might appear delayed
2023-08-09T13:55:08.521 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-08-09T13:55:08.908 helix_term::application [DEBUG] received editor event: IdleTimer
2023-08-09T13:55:08.912 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-08-09T13:56:44.251 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-08-09T13:56:44.252 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-08-09T13:56:44.253 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-08-09T13:56:44.255 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-08-09T13:56:44.656 helix_term::application [DEBUG] received editor event: IdleTimer
2023-08-09T13:56:44.656 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-08-09T13:56:49.068 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 1
2023-08-09T13:56:49.069 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 1
2023-08-09T13:56:49.070 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 1
2023-08-09T13:56:49.071 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 1
2023-08-09T13:56:49.071 helix_term::commands::typed [DEBUG] quitting...
2023-08-09T13:56:49.072 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 1
2023-08-09T13:56:49.073 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 1
2023-08-09T13:56:49.073 helix_term::job [DEBUG] waiting on jobs...
2023-08-09T13:56:49.073 helix_term::job [DEBUG] waiting on jobs...

Platform

Mac OS (Helix installed via Nix)

Terminal Emulator

Kitty 0.28.1

Helix Version

helix 23.05 (7f5940b)

@nikitawootten-nist nikitawootten-nist added the C-bug Category: This is a bug label Aug 9, 2023
@pascalkuthe
Copy link
Member

This was already fixed in #7227. Either upgrade to latest master or compile with rustc 1.70 or older

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

2 participants