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 in IdeMenu::create_value_string #805

Open
samuelallan72 opened this issue Jul 7, 2024 · 1 comment
Open

Panic in IdeMenu::create_value_string #805

samuelallan72 opened this issue Jul 7, 2024 · 1 comment
Labels
A-Completions Area: Tab completion and inline hint completions bug Something isn't working

Comments

@samuelallan72
Copy link

Platform Linux (Ubuntu)
Terminal software Alacritty

A panic is observed when attempting to complete a long directory name using ide completion menu.

Steps to reproduce

  1. make a very long set of nested directories (so the full path is ~300 characters long)
  2. make some files in the final nested directory so there is something to complete using the completion menu
  3. configure ide_completion_menu in nushell
  4. enter something like cd longdir/longdir/longdir/ then hit tab to open the ide_completion_menu
  5. reedline panics, abruptly cancelling the current command line,dropping you into a new prompt line.

Traceback:

                               Error:   × Main thread panicked.
  ├─▶ at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/str/mod.rs:666:21
  ╰─▶ byte index 240 is out of bounds of `anoeuhnaoehunatehountaehounaoehuneohunsauhnah...`
         0: 0x5a437e9adc44 - rust_begin_unwind
                      at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panicking.rs:647
         1: 0x5a437b4dc7c5 - core::panicking::panic_fmt::ha6effc2775a0749c
                      at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/panicking.rs:72
         2: 0x5a437e9e4621 - core::str::slice_error_fail_rt::hae2b0a3e014351e1
         3: 0x5a437b4dd0d7 - core::str::slice_error_fail::he2ff12236fb0c056
                      at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/str/mod.rs:91
         4: 0x5a437ce369a1 - core::str::<impl str>::split_at::h81de194d99ab07fb
                      at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/str/mod.rs:666
         5: 0x5a437ce6b170 -
      reedline::menu::ide_menu::IdeMenu::create_value_string::h813b3b0d2258abdc
                      at /home/ubuntu/.cargo/git/checkouts/reedline-e42026a78d91c510/480059a/src/menu/ide_menu.rs:518
         6: 0x5a437ce70126 - <reedline::menu::ide_menu::IdeMenu as
      reedline::menu::Menu>::menu_string::{{closure}}::hcca6888784b61807
                      at /home/ubuntu/.cargo/git/checkouts/reedline-e42026a78d91c510/480059a/src/menu/ide_menu.rs:865
         7: 0x5a437ce281a8 - core::iter::adapters::map::map_fold::
      {{closure}}::ha6d0c74022d43ba6
                      at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/iter/adapters/map.rs:89
         8: 0x5a437cdc20b5 - <core::iter::adapters::enumerate::Enumerate<I>
      as core::iter::traits::iterator::Iterator>::fold::enumerate::
      {{closure}}::hd9cda5be10aa6676
                      at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/iter/adapters/enumerate.rs:107
         9: 0x5a437ce2b6b0 - <core::iter::adapters::take::Take<I> as
      core::iter::adapters::take::SpecTake>::spec_fold::hc63d5ccffe302f0f
                      at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/iter/adapters/take.rs:307
        10: 0x5a437ce20c07 - <core::iter::adapters::take::Take<I> as
      core::iter::traits::iterator::Iterator>::fold::hb90d07da7b566570
                      at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/iter/adapters/take.rs:110
        11: 0x5a437cdc1aec - <core::iter::adapters::enumerate::Enumerate<I> as
      core::iter::traits::iterator::Iterator>::fold::h94b5772058644f73
                      at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/iter/adapters/enumerate.rs:113
        12: 0x5a437ce22bb0 - <core::iter::adapters::map::Map<I,F> as
      core::iter::traits::iterator::Iterator>::fold::h450f2811313e0723
                      at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/iter/adapters/map.rs:129
        13: 0x5a437ce26b66 -
      core::iter::traits::iterator::Iterator::for_each::he96e174075427981
                      at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/iter/traits/iterator.rs:858
        14: 0x5a437cda20b1 - alloc::vec::Vec<T,A>::extend_trusted::ha7ac793a510ea1f5
                      at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/alloc/src/vec/mod.rs:2962
        15: 0x5a437cdaaf0b - <alloc::vec::Vec<T,A> as
      alloc::vec::spec_extend::SpecExtend<T,I>>::spec_extend::h96a12434310fcb4f
                      at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/alloc/src/vec/spec_extend.rs:26
        16: 0x5a437cd9dd46 - <alloc::vec::Vec<T> as
      alloc::vec::spec_from_iter_nested::SpecFromIterNested<T,I>>::from_iter::h46a2a11d0a6515
      ce
                      at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/alloc/src/vec/spec_from_iter_nested.rs:62
        17: 0x5a437cdab26e - <alloc::vec::Vec<T> as
      alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter::hb6af4c2d51c49fef
                      at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/alloc/src/vec/spec_from_iter.rs:33
        18: 0x5a437cdaac67 - <alloc::vec::Vec<T> as
      core::iter::traits::collect::FromIterator<T>>::from_iter::hb4e9732b892f811c
                      at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/alloc/src/vec/mod.rs:2836
        19: 0x5a437ce2672e - core::iter::traits::iterator::Iterator::collect::he13b36f9720b6fbf
                      at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/iter/traits/iterator.rs:2054
        20: 0x5a437ce6df21 - <reedline::menu::ide_menu::IdeMenu as
      reedline::menu::Menu>::menu_string::h4ebb240f89bd4850
                      at /home/ubuntu/.cargo/git/checkouts/reedline-e42026a78d91c510/480059a/src/menu/ide_menu.rs:855
        21: 0x5a437ce51bdf - <reedline::menu::ReedlineMenu as
      reedline::menu::Menu>::menu_string::ha6e8b1ad62154375
                      at /home/ubuntu/.cargo/git/checkouts/reedline-e42026a78d91c510/480059a/src/menu/mod.rs:457
        22: 0x5a437ce59612 -
      reedline::painting::painter::Painter::print_menu::hee4f0b578856f140
                      at /home/ubuntu/.cargo/git/checkouts/reedline-e42026a78d91c510/480059a/src/painting/painter.rs:307
        23: 0x5a437ce5a14b -
      reedline::painting::painter::Painter::print_small_buffer::h416fd091bf2fca8a
                      at /home/ubuntu/.cargo/git/checkouts/reedline-e42026a78d91c510/480059a/src/painting/painter.rs:359
        24: 0x5a437ce5880f -
      reedline::painting::painter::Painter::repaint_buffer::hf3fac28380e128ea
                      at /home/ubuntu/.cargo/git/checkouts/reedline-e42026a78d91c510/480059a/src/painting/painter.rs:234
        25: 0x5a437cdeb79d - reedline::engine::Reedline::buffer_paint::h4feb09b9f0ba21a6
                      at /home/ubuntu/.cargo/git/checkouts/reedline-e42026a78d91c510/480059a/src/engine.rs:1803
        26: 0x5a437cde820b - reedline::engine::Reedline::repaint::h3c937814ee4c5aa5
                      at /home/ubuntu/.cargo/git/checkouts/reedline-e42026a78d91c510/480059a/src/engine.rs:1505
        27: 0x5a437cde16c9 - reedline::engine::Reedline::read_line_helper::hca4a4e7a9f56d1e0
                      at /home/ubuntu/.cargo/git/checkouts/reedline-e42026a78d91c510/480059a/src/engine.rs:802
        28: 0x5a437cde09d0 - reedline::engine::Reedline::read_line::hb4875dc9b10f36aa
                      at /home/ubuntu/.cargo/git/checkouts/reedline-e42026a78d91c510/480059a/src/engine.rs:646
        29: 0x5a437cc94492 - nu_cli::repl::loop_iteration::ha973a13cebb9a432
                      at /home/ubuntu/proj/other/nushell/crates/nu-cli/src/repl.rs:423
        30: 0x5a437cc29112 - nu_cli::repl::evaluate_repl::{{closure}}::h7f3aa7c21bc67c63
                      at /home/ubuntu/proj/other/nushell/crates/nu-cli/src/repl.rs:170
        31: 0x5a437ccdf68d - <core::panic::unwind_safe::AssertUnwindSafe<F> as
      core::ops::function::FnOnce<()>>::call_once::h86a0c8469438db73
                      at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/panic/unwind_safe.rs:272
        32: 0x5a437cc2809f - std::panicking::try::do_call::h31b3e1362eac501b
                      at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panicking.rs:554
        33: 0x5a437cc2817b - __rust_try
        34: 0x5a437cc27f9e - std::panicking::try::he7cb97b635bbb52b
                      at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panicking.rs:518
        35: 0x5a437cc23e5e - std::panic::catch_unwind::h0f6a74fa891a7770
                      at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panic.rs:142
        36: 0x5a437cc8e3d3 - nu_cli::repl::evaluate_repl::h3edcdc9173f5212e
                      at /home/ubuntu/proj/other/nushell/crates/nu-cli/src/repl.rs:169
        37: 0x5a437b4f62be - nu::run::run_repl::hf85fc1cf3966412f
                      at /home/ubuntu/proj/other/nushell/src/run.rs:204
        38: 0x5a437b4ebf3d - nu::main::hb1c880516be63ecf
                      at /home/ubuntu/proj/other/nushell/src/main.rs:420
        39: 0x5a437b5125cb - core::ops::function::FnOnce::call_once::hc1388be915146734

@samuelallan72 samuelallan72 added the bug Something isn't working label Jul 7, 2024
@ysthakur
Copy link
Member

ysthakur commented Jul 7, 2024

Thanks for reporting this issue and providing all those details. nushell/nushell#13208 over in Nushell is related

@ysthakur ysthakur added the A-Completions Area: Tab completion and inline hint completions label Sep 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Completions Area: Tab completion and inline hint completions bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants