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

segfault when editing iptables dump file commited in a git repo #7896

Closed jficz closed 1 year ago

jficz commented 1 year ago

Summary

This is and oddly specific bug.

When doing xxd action in an iptables config file that is commited in git, helix segfaults with no apparently usable logs. It also breaks the terminal.

Tried foot and kitty terminals, zsh and bash shells. Seems to be independent of these.

Reproduction Steps

1. `git init repo; cd repo` 2. `sudo iptables-save > iptables` 3. `git add iptables; git commit -m 'test'` 4. `hx iptables` 5. go to a random line, make sure you're in `NOR` mode and pres `xxxd` 6. _segmentation fault (core dumped) hx iptables_ Asciinema record: https://asciinema.org/a/VF4XKet1b8X8ljjrhElvqEjla Warning: this will likely break your terminal's input, you will need to close it and start a new one. If you play the asciinema record locally, it will also most likely break your terminal. ### Helix log ``` 2023-08-10T15:04:24.993 helix_view::clipboard [DEBUG] Using wl-copy+wl-paste to interact with the system and selection (primary) clipboard 2023-08-10T15:04:24.994 helix_view::editor [DEBUG] editor status: Loaded 1 file. 2023-08-10T15:04:24.994 mio::poll [TRACE] registering event source with poller: token=Token(0), interests=READABLE | WRITABLE 2023-08-10T15:04:24.994 mio::poll [TRACE] registering event source with poller: token=Token(1), interests=READABLE | WRITABLE 2023-08-10T15:04:24.994 mio::poll [TRACE] registering event source with poller: token=Token(0), interests=READABLE 2023-08-10T15:04:24.994 mio::poll [TRACE] registering event source with poller: token=Token(1), interests=READABLE 2023-08-10T15:04:24.998 helix_tui::backend::crossterm [DEBUG] The keyboard enhancement protocol is supported in this terminal (checked in 3.23095ms) 2023-08-10T15:04:24.998 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0 2023-08-10T15:04:25.394 helix_term::application [DEBUG] received editor event: IdleTimer 2023-08-10T15:04:35.319 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0 2023-08-10T15:04:35.610 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0 2023-08-10T15:04:35.938 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0 2023-08-10T15:04:36.129 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0 ``` ### Platform Linux - NixOS ### Terminal Emulator kitty, foot ### Helix Version helix 23.05 (7f5940be)
jficz commented 1 year ago

I don't know exactly which part of the file is the trigger. I tried the same thing with other config files (fstab, passwd, to name a few) but only the iptables format triggered the issue (so far).

pascalkuthe commented 1 year ago

This was fixed a while ago by #7227. Either upgrade to master or build with rustc <= 1.70

lunagl commented 1 year ago

When are you planning on releasing this important fix? The current situation is really annoying for anyone not wanting to build the package themselves

jficz commented 1 year ago

I've been trying to build the package on NixOS but nixpkgs uses the release tarball to build the package and not the repo and I have zero experience building rust packages on NixOS.

An ETA on the release would be nice so I know if I should invest time to learn Rust build principles (which I will likely never use again) or wait for the release.

pascalkuthe commented 1 year ago

Releases happen approximately every 3 months so it will likely happen this or next month. We don't have any strict timelines, and will not commit to such. The official 23.5 release that you can download from our website was built with a rust-toolchain where this issue doesn't occur so you can just use the official release to avoid the problem (or the official nix flake).

All other sources of helix builds (package managers) are unofficial and not supported by us. If they ship a broken package that is their problem. In this case, the issue seems to be nixos so the nixpkgs should either continue building helix with the older toolchain (as they have done in the past) or apply the liked PR as a patch until then.