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

Crash when hitting Ctrl-W at the beginning of the edit buffer #12

Open
pothos opened this issue Oct 23, 2021 · 1 comment
Open

Crash when hitting Ctrl-W at the beginning of the edit buffer #12

pothos opened this issue Oct 23, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@pothos
Copy link

pothos commented Oct 23, 2021

First of all, impressive work - great experience to use it so far!

I just hit a panic when I pressed Ctrl-W (I think) when editing a line from the front.

[ERROR	] /home/kai/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/nsh-0.4.2/src/main.rs: panicked at 'called `Result::unwrap()` on an `Err` value: RecvError', /home/kai/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/nsh-0.4.2/src/bash_server.rs:26:33
[WARN	] /home/kai/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/nsh-0.4.2/src/mainloop.rs: unsupported key event: KeyEvent { code: Left, modifiers: CONTROL }
[WARN	] /home/kai/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/nsh-0.4.2/src/mainloop.rs: unsupported key event: KeyEvent { code: Left, modifiers: CONTROL }
[WARN	] /home/kai/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/nsh-0.4.2/src/mainloop.rs: unsupported key event: KeyEvent { code: Left, modifiers: CONTROL }
[WARN	] /home/kai/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/nsh-0.4.2/src/mainloop.rs: unsupported key event: KeyEvent { code: Left, modifiers: CONTROL }
[WARN	] /home/kai/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/nsh-0.4.2/src/mainloop.rs: unsupported key event: KeyEvent { code: Left, modifiers: SHIFT }
[WARN	] /home/kai/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/nsh-0.4.2/src/mainloop.rs: unsupported key event: KeyEvent { code: Left, modifiers: SHIFT }
[WARN	] /home/kai/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/nsh-0.4.2/src/mainloop.rs: unsupported key event: KeyEvent { code: Right, modifiers: ALT }
[WARN	] /home/kai/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/nsh-0.4.2/src/mainloop.rs: unsupported key event: KeyEvent { code: Right, modifiers: ALT }
[ERROR	] /home/kai/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/nsh-0.4.2/src/main.rs: panicked at 'called `Result::unwrap()` on an `Err` value: RecvError', /home/kai/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/nsh-0.4.2/src/bash_server.rs:26:33
[ERROR	] /home/kai/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/nsh-0.4.2/src/main.rs: panicked at 'called `Result::unwrap()` on an `Err` value: RecvError', /home/kai/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/nsh-0.4.2/src/bash_server.rs:26:33
[ERROR	] /home/kai/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/nsh-0.4.2/src/main.rs: panicked at 'called `Result::unwrap()` on an `Err` value: RecvError', /home/kai/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/nsh-0.4.2/src/bash_server.rs:26:33
[WARN	] /home/kai/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/nsh-0.4.2/src/mainloop.rs: unsupported key event: KeyEvent { code: BackTab, modifiers: SHIFT }
[WARN	] /home/kai/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/nsh-0.4.2/src/mainloop.rs: unsupported key event: KeyEvent { code: Left, modifiers: CONTROL }
[WARN	] /home/kai/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/nsh-0.4.2/src/mainloop.rs: unsupported key event: KeyEvent { code: Left, modifiers: CONTROL }
[ERROR	] /home/kai/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/nsh-0.4.2/src/main.rs: panicked at 'byte index 18446744073709551615 is out of bounds of ` <(cat ho)`', /rustc/09c42c45858d5f3aedfa670698275303a3d19afa/library/alloc/src/string.rs:1250:24
[ERROR	] /home/kai/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/nsh-0.4.2/src/main.rs:    0:     0x55e00df2c34e - backtrace::backtrace::libunwind::trace::ha92b05c3835a19b3
                               at /home/kai/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/backtrace-0.3.62/src/backtrace/libunwind.rs:93:5
                           backtrace::backtrace::trace_unsynchronized::h5bd46d966599ad53
                               at /home/kai/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/backtrace-0.3.62/src/backtrace/mod.rs:66:5
                           backtrace::backtrace::trace::hc0cd2fe75e0630e9
                               at /home/kai/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/backtrace-0.3.62/src/backtrace/mod.rs:53:14
                           backtrace::capture::Backtrace::create::hbe88d678c6254fcc
                               at /home/kai/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/backtrace-0.3.62/src/capture.rs:176:9
                           backtrace::capture::Backtrace::new::h55226a7eaa89bbb3
                               at /home/kai/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/backtrace-0.3.62/src/capture.rs:140:22
   1:     0x55e00def63aa - nsh::main::{{closure}}::hbdf33c6259b88669
                               at /home/kai/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/nsh-0.4.2/src/main.rs:190:25
   2:     0x55e00dfa04d6 - std::panicking::rust_panic_with_hook::h32c44b1364c1c247
                               at /rustc/09c42c45858d5f3aedfa670698275303a3d19afa/library/std/src/panicking.rs:628:17
   3:     0x55e00dfc1c78 - std::panicking::begin_panic_handler::{{closure}}::he2e5f48fb16982d1
                               at /rustc/09c42c45858d5f3aedfa670698275303a3d19afa/library/std/src/panicking.rs:521:13
   4:     0x55e00dfc1bf6 - std::sys_common::backtrace::__rust_end_short_backtrace::haea54a33f9e18aba
                               at /rustc/09c42c45858d5f3aedfa670698275303a3d19afa/library/std/src/sys_common/backtrace.rs:141:18
   5:     0x55e00dfc1bb2 - rust_begin_unwind
                               at /rustc/09c42c45858d5f3aedfa670698275303a3d19afa/library/std/src/panicking.rs:517:5
   6:     0x55e00de5fcb0 - core::panicking::panic_fmt::h824e0febbdf5e655
                               at /rustc/09c42c45858d5f3aedfa670698275303a3d19afa/library/core/src/panicking.rs:101:14
   7:     0x55e00de601ac - core::str::slice_error_fail::h416bbb3b8269e469
   8:     0x55e00decd3cc - nsh::mainloop::UserInput::remove_until_word_start::hcfc8b7422d12c885
                           nsh::mainloop::Mainloop::handle_key_event::hc2d9e41aad7e6c31
                               at /home/kai/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/nsh-0.4.2/src/mainloop.rs:383:17
   9:     0x55e00dec911f - nsh::mainloop::Mainloop::handle_event::h9da7cc13584b9546
                               at /home/kai/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/nsh-0.4.2/src/mainloop.rs:267:44
  10:     0x55e00dec591e - nsh::mainloop::Mainloop::run::h89f95d1cb82c50be
                               at /home/kai/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/nsh-0.4.2/src/mainloop.rs:161:29
  11:     0x55e00def3a50 - nsh::interactive_mode::hcbcb561b5dd1dbc9
                               at /home/kai/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/nsh-0.4.2/src/main.rs:68:5
                           nsh::shell_main::hc8f90789de9f5633
                               at /home/kai/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/nsh-0.4.2/src/main.rs:124:13
  12:     0x55e00def608d - nsh::main::hd9825816e817867a
                               at /home/kai/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/nsh-0.4.2/src/main.rs:203:5
  13:     0x55e00de67953 - core::ops::function::FnOnce::call_once::h049cc098aa9d1397
                               at /rustc/09c42c45858d5f3aedfa670698275303a3d19afa/library/core/src/ops/function.rs:227:5
                           std::sys_common::backtrace::__rust_begin_short_backtrace::hc50c39f301db3c0e
                               at /rustc/09c42c45858d5f3aedfa670698275303a3d19afa/library/std/src/sys_common/backtrace.rs:125:18
  14:     0x55e00df0fbf4 - main
  15:     0x7fd1f9401e4a - __libc_start_main
                               at ./csu/../csu/libc-start.c:314:16
  16:     0x55e00de6582a - _start
  17:                0x0 - <unknown>

[ERROR	] /home/kai/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/nsh-0.4.2/src/main.rs: panicked at 'called `Result::unwrap()` on an `Err` value: RecvError', /home/kai/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/nsh-0.4.2/src/bash_server.rs:26:33
[WARN	] /home/kai/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/nsh-0.4.2/src/mainloop.rs: unsupported key event: KeyEvent { code: Left, modifiers: CONTROL }
[WARN	] /home/kai/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/nsh-0.4.2/src/mainloop.rs: unsupported key event: KeyEvent { code: Left, modifiers: CONTROL }
[WARN	] /home/kai/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/nsh-0.4.2/src/mainloop.rs: unsupported key event: KeyEvent { code: Left, modifiers: CONTROL }
[ERROR	] /home/kai/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/nsh-0.4.2/src/main.rs: panicked at 'called `Result::unwrap()` on an `Err` value: RecvError', /home/kai/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/nsh-0.4.2/src/bash_server.rs:26:33
@nuta nuta added the bug Something isn't working label Oct 24, 2021
@nuta
Copy link
Owner

nuta commented Oct 24, 2021

Thank you for reporting the bug. It seems nsh crashes in UserInput::remove_until_word_start(). I'll fix it when I have time.

panicked at 'byte index 18446744073709551615 is out of bounds of ` <(cat ho)`',
...
   8:     0x55e00decd3cc - nsh::mainloop::UserInput::remove_until_word_start::hcfc8b7422d12c885
                           nsh::mainloop::Mainloop::handle_key_event::hc2d9e41aad7e6c31
                               at /home/kai/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/nsh-0.4.2/src/mainloop.rs:383:17
   9:     0x55e00dec911f - nsh::mainloop::Mainloop::handle_event::h9da7cc13584b9546
                               at /home/kai/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/nsh-0.4.2/src/mainloop.rs:267:44

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants