helix-editor / helix

A post-modern modal text editor.
https://helix-editor.com
Mozilla Public License 2.0
33.76k stars 2.51k forks source link

Segmentation Fault trying to edit file in Mac Sonoma #8415

Closed santhosh-tekuri closed 1 year ago

santhosh-tekuri commented 1 year ago

Summary

I did clean install of Mac osx sonoma on my silicon Mac. after installing helix using home-brew, I noticed that I am getting segmentation fault while trying to edit files in some projects.

just open some file in the project and press o to open line. it gives segmentation fault. it is not happening in all projects. but it few projects it happens always consistently.

Reproduction Steps

No response

Helix log

~/.cache/helix/helix.log ``` 2023-09-28T18:26:59.104 helix_view::clipboard [DEBUG] Using pbcopy+pbpaste to interact with the system clipboard 2023-09-28T18:26:59.107 globset [DEBUG] glob converted to regex: Glob { glob: "*.{zip,gz,bz2,zst,lzo,sz,tgz,tbz2,lz,lz4,lzma,lzo,z,Z,xz,7z,rar,cab}", re: "(?-u)^[^/]*\\.(cab|rar|7z|xz|Z|z|lzo|lzma|lz4|lz|tbz2|tgz|sz|lzo|zst|bz2|gz|zip)$", opts: GlobOptions { case_insensitive: false, literal_separator: true, backslash_escape: true }, tokens: Tokens([ZeroOrMore, Literal('.'), Alternates([Tokens([Literal('c'), Literal('a'), Literal('b')]), Tokens([Literal('r'), Literal('a'), Literal('r')]), Tokens([Literal('7'), Literal('z')]), Tokens([Literal('x'), Literal('z')]), Tokens([Literal('Z')]), Tokens([Literal('z')]), Tokens([Literal('l'), Literal('z'), Literal('o')]), Tokens([Literal('l'), Literal('z'), Literal('m'), Literal('a')]), Tokens([Literal('l'), Literal('z'), Literal('4')]), Tokens([Literal('l'), Literal('z')]), Tokens([Literal('t'), Literal('b'), Literal('z'), Literal('2')]), Tokens([Literal('t'), Literal('g'), Literal('z')]), Tokens([Literal('s'), Literal('z')]), Tokens([Literal('l'), Literal('z'), Literal('o')]), Tokens([Literal('z'), Literal('s'), Literal('t')]), Tokens([Literal('b'), Literal('z'), Literal('2')]), Tokens([Literal('g'), Literal('z')]), Tokens([Literal('z'), Literal('i'), Literal('p')])])]) } 2023-09-28T18:26:59.107 globset [DEBUG] built glob set; 0 literals, 0 basenames, 0 extensions, 0 prefixes, 0 suffixes, 0 required extensions, 1 regexes 2023-09-28T18:26:59.108 globset [DEBUG] built glob set; 3 literals, 0 basenames, 0 extensions, 0 prefixes, 0 suffixes, 0 required extensions, 0 regexes 2023-09-28T18:26:59.110 ignore::walk [DEBUG] ignoring ./.gitignore: Ignore(IgnoreMatch(Hidden)) 2023-09-28T18:26:59.110 ignore::walk [DEBUG] ignoring ./.git: Ignore(IgnoreMatch(Hidden)) 2023-09-28T18:26:59.111 helix_term::ui [DEBUG] file_picker init 6.693041ms 2023-09-28T18:26:59.112 mio::poll [TRACE] registering event source with poller: token=Token(0), interests=READABLE | WRITABLE 2023-09-28T18:26:59.112 mio::poll [TRACE] registering event source with poller: token=Token(1), interests=READABLE | WRITABLE 2023-09-28T18:26:59.112 mio::poll [TRACE] registering event source with poller: token=Token(0), interests=READABLE 2023-09-28T18:26:59.112 mio::poll [TRACE] registering event source with poller: token=Token(1), interests=READABLE 2023-09-28T18:26:59.116 helix_tui::backend::crossterm [DEBUG] The keyboard enhancement protocol is not supported in this terminal (checked in 3.864ms) 2023-09-28T18:26:59.116 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0 2023-09-28T18:26:59.505 helix_term::application [DEBUG] received editor event: IdleTimer 2023-09-28T18:26:59.507 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0 2023-09-28T18:26:59.533 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0 2023-09-28T18:27:00.841 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0 2023-09-28T18:27:01.243 helix_term::application [DEBUG] received editor event: IdleTimer 2023-09-28T18:27:01.244 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0 2023-09-28T18:27:01.853 helix_view::editor [ERROR] Failed to initialize the LSP for `source.md` { cannot find binary path } 2023-09-28T18:27:01.853 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0 2023-09-28T18:27:01.854 helix_view::document [DEBUG] id 2 modified - last saved: 0, current: 0 2023-09-28T18:27:01.854 helix_term::ui::picker [INFO] picker closed before syntax highlighting finished 2023-09-28T18:27:01.855 helix_view::document [DEBUG] id 2 modified - last saved: 0, current: 0 2023-09-28T18:27:01.855 helix_term::application [DEBUG] received editor event: IdleTimer ```

Platform

macOS

Terminal Emulator

wezterm 20230712-072601-f4abf8fd

Helix Version

helix 23.05 (7f5940be)

the-mikedavis commented 1 year ago

Segfaults are usually caused by buggy tree-sitter scanners (which are written in C/C++). Can you narrow down which file is causing this?

santhosh-tekuri commented 1 year ago

here are the steps:

git clone https://github.com/santhosh-tekuri/jsonschema.git
cd jsonschema
hx draft.go
press o

this seems to be happening with .go and .md and .rs files.

santhosh-tekuri commented 1 year ago

@the-mikedavis I noticed one thing. If I delete .git folder then i am able to edit files without any issue.

looks like .git folder presence is causing the segfault

the issue might be something with rendering git gutter

santhosh-tekuri commented 1 year ago

I tried following steps:

 0: _rust_begin_unwind
   1: core::panicking::panic_fmtnicked at 'range end index 18446744073709551615 out of range for slice of length 0', /Users/brew/Library/Caches/Homebrew/cargo_cache   2: core::slice::index::slice_end_index_len_failey-1.6.0/src/tree/node_children.rs:312:21
   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::task::blocking::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::loom::std::unsafe_cell::UnsafeCell<T>::with_mut
  19: tokio::runtime::task::core::Core<T,S>::poll
  20: tokio::runtime::task::harness::Harness<T,S>::poll
  21: tokio::runtime::blocking::pool::Inner::run
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
pascalkuthe commented 1 year ago

yeanh that is a known issue that is fixed on master for a long time (#7227). Its caused by compiling with a newer rust compiler. The issue is not present in the official release binary or master. This is an issue with the homebrew package

santhosh-tekuri commented 1 year ago

@pascalkuthe

Thanks. I used the one from GitHub Releases and it works great

vwkd commented 1 year ago

@pascalkuthe

yeanh that is a known issue that is fixed on master for a long time

This issue shares a common characteristic with other issues. It's another example why the infrequent release schedule isn't a good idea. Users on the official release run into bugs months after they have been fixed because the project doesn't release (here: last released in May, fixed June, bug as of October). Unfortunately, the maintainers seem unwilling to fix their release process to release more frequently. https://github.com/helix-editor/helix/discussions/6362