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

Panic when accepting element from help menu #602

Closed
dedebenui opened this issue Jul 13, 2023 · 2 comments
Closed

Panic when accepting element from help menu #602

dedebenui opened this issue Jul 13, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@dedebenui
Copy link

Platform macOS 13.4
Terminal software kitty 0.29.0

I don't really know in what broader context it occurs, but here's a sequence of input that will consistently make nushell crash. From the trace, it looks like the panic occurs in Reedline.

Steps to reproduce

  1. new shell
  2. type
def fn [] {
return 
  1. while still on the second line (ends with a space), hit F1 to get the help menu
  2. start typing the name of a command
  3. accept with enter

At this point, nushell panics.

Backtrace
thread 'main' panicked at 'assertion failed: self.is_char_boundary(idx)', /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/alloc/src/string.rs:1532:9
stack backtrace:
   0:        0x10a827f7b - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hae51cb91d407e2ef
   1:        0x109c7261b - core::fmt::write::h746bc0969202388b
   2:        0x10a82252c - std::io::Write::write_fmt::h4098c2c7437a0bd7
   3:        0x10a827d5a - std::sys_common::backtrace::print::h8360bf0158e89b36
   4:        0x10a82c461 - std::panicking::default_hook::{{closure}}::hedf04c568eb6e0bc
   5:        0x10a82c23f - std::panicking::default_hook::h62889b2c29e2347d
   6:        0x10a82caba - std::panicking::rust_panic_with_hook::h22edd02828aff274
   7:        0x10a82c838 - std::panicking::begin_panic_handler::{{closure}}::h6895f44a9b7e2caa
   8:        0x10a82a9e9 - std::sys_common::backtrace::__rust_end_short_backtrace::h013519e9b77978c5
   9:        0x10a82c5e2 - _rust_begin_unwind
  10:        0x10a9fa763 - core::panicking::panic_fmt::h2a51b60c12d11322
  11:        0x10a9fa7f7 - core::panicking::panic::h00b4c20719c0abc2
  12:        0x10a76a0e8 - reedline::core_editor::line_buffer::LineBuffer::insert_char::hf2a552f7a55a11e7
  13:        0x10a745e39 - reedline::core_editor::editor::Editor::run_edit_command::h624514b8504fc16c
  14:        0x10a75efe3 - reedline::engine::Reedline::run_edit_commands::hd8b36992cc5f2d1d
  15:        0x10a75d6cf - reedline::engine::Reedline::handle_editor_event::ha92289a8d22ff7bb
  16:        0x10a75b452 - reedline::engine::Reedline::read_line::hc616b4c261fb9170
  17:        0x109d66750 - nu_cli::repl::evaluate_repl::h9957f66c10655d45
  18:        0x109d1d585 - nu::run::run_repl::hede6b45757945f7b
  19:        0x109d2d70a - nu::main::he997e5adb84189eb
  20:        0x109d19475 - std::sys_common::backtrace::__rust_begin_short_backtrace::h3c3e14cdf033eec4
  21:        0x109d342a9 - std::rt::lang_start::{{closure}}::ha16c124dd0ec880b
  22:        0x10a81bfd2 - std::rt::lang_start_internal::h36134e47b0b0d769
  23:        0x109d2e3ac - _main
  24:     0x7ff811fbf41f - <unknown>
@dedebenui dedebenui added the bug Something isn't working label Jul 13, 2023
@sholderbach
Copy link
Member

Thanks for the reproducible example and backtrace. This sounds like a variation of nushell/nushell#9627 probably needs to be addressed here in reedline.

fdncred pushed a commit to nushell/nushell that referenced this issue Aug 14, 2023
…the help menu (#9784)

<!--
if this PR closes one or more issues, you can automatically link the PR
with
them by using one of the [*linking
keywords*](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword),
e.g.
- this PR should close #xxxx
- fixes #xxxx

you can also mention related issues, PRs or discussions!
-->

# Description
<!--
Thank you for improving Nushell. Please, check our [contributing
guide](../CONTRIBUTING.md) and talk to the core team before making major
changes.

Description of your pull request goes here. **Provide examples and/or
screenshots** if your changes affect the user experience.
-->
Fixes #9627 
Related nushell/reedline#602 nushell/reedline#612

# User-Facing Changes
<!-- List of all changes that impact the user experience here. This
helps us keep track of breaking changes. -->

# Tests + Formatting
<!--
Don't forget to add tests that cover your changes.

Make sure you've run and fixed any issues with these commands:

- `cargo fmt --all -- --check` to check standard code formatting (`cargo
fmt --all` applies these changes)
- `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A
clippy::needless_collect -A clippy::result_large_err` to check that
you're using the standard code style
- `cargo test --workspace` to check that all tests pass
- `cargo run -- -c "use std testing; testing run-tests --path
crates/nu-std"` to run the tests for the standard library

> **Note**
> from `nushell` you can also use the `toolkit` as follows
> ```bash
> use toolkit.nu # or use an `env_change` hook to activate it
automatically
> toolkit check pr
> ```
-->

# After Submitting
<!-- If your PR had any user-facing changes, update [the
documentation](https://github.com/nushell/nushell.github.io) after the
PR is merged, if necessary. This will help us keep the docs up to date.
-->
@sholderbach
Copy link
Member

For now closed on the nushell side by #9784

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