helix-editor / helix

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

Helix panics on pkill -USR1 #7459

Open mkapra opened 1 year ago

mkapra commented 1 year ago

Summary

helix panics when changing the theme in the configuration file on USR1 signal.

Reproduction Steps

I tried this: 1. `:config-open` 2. Change the theme to another theme and save the configuration 3. Spawn a new terminal and run `pkill -USR1 hx` I expected this to happen: The configuration gets reloaded and the color scheme changes. Instead, this happened: ``` thread 'main' panicked at 'index out of bounds: the len is 72 but the index is 81', /home/runner/work/helix/helix/helix-view/src/theme.rs:297:9 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace Bus error ``` ### Helix log
~/.cache/helix/helix.log ``` 2023-06-26T17:25:32.665 helix_term::application [WARN] failed to load theme `rose_pine_dawn` - Theme: file not found for: rose_pine_dawn ``` The confusing part is here that it says it could not find the theme. When restarting helix the theme is working.
### Platform Linux ### Terminal Emulator kitty ### Helix Version helix 23.05 (7f5940be)
the-mikedavis commented 1 year ago

Which themes are you switching between? Also, could you reproduce this with the the RUST_BACKTRACE environment variable set to full?

mkapra commented 1 year ago

I am using the themes rose_pine_(dawn|moon)

I tried setting RUST_BACKTRACE to 1 but the printed error was the same. With RUST_BACKTRACE = full its the same output too.

mkapra commented 1 year ago

Maybe this is interesting too: If I call :config-reload then the theme switch is made without any error.

archseer commented 1 year ago

The error will be the same, but the backtrace is useful for debugging.

mkapra commented 1 year ago

With that message I meant that there is no stack trace. Just the same message as before:

> RUST_BACKTRACE=full hx
thread 'main' panicked at 'index out of bounds: the len is 72 but the index is 81', /home/runner/work/helix/helix/helix-view/src/theme.rs:297:9
stack backtrace:
Bus error
Snoupix commented 1 year ago

I tried on the version (master 23.05 843ae971) and I have no problem at all. My setup is not the same as yours (WSL, Arch), but it's changing both themes (rose pine moon and dawn) with :config-reload and with pkill -USR1 hx.

I'd like to help you but I can't reproduce the bug on my side.