Skip to content

reject panic when given columns with the same name #8431

@tzhao11

Description

@tzhao11

Describe the bug

nu crashes when running [[a, a]; [1, 2]] | reject a:

thread 'main' panicked at 'removal index (is 1) should be < len (is 1)', crates/nu-protocol/src/value/mod.rs:1213:54
stack backtrace:
   0:        0x1059f367c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h77a3f883b881e197
   1:        0x104f4120c - core::fmt::write::hfe6f93d759ccd95a
   2:        0x1059d72c8 - std::io::Write::write_fmt::h71789c72c0e637c1
   3:        0x1059f34ac - std::sys_common::backtrace::print::h4e2277b8eaab21a0
   4:        0x1059e91fc - std::panicking::default_hook::{{closure}}::hdbbe4474ff2bfccd
   5:        0x1059e8fb8 - std::panicking::default_hook::hfe3a9cc61ee4ffb6
   6:        0x1059e9808 - std::panicking::rust_panic_with_hook::h980b0940bb63c408
   7:        0x1059f3bd4 - std::panicking::begin_panic_handler::{{closure}}::h13fa53a0067274f4
   8:        0x1059f37ac - std::sys_common::backtrace::__rust_end_short_backtrace::h99b7fc1de0b3fb76
   9:        0x1059e9364 - _rust_begin_unwind
  10:        0x105b87040 - core::panicking::panic_fmt::h69eebccea18044bb
  11:        0x105b86a98 - alloc::vec::Vec<T,A>::remove::assert_failed::h887559752fa93661
  12:        0x105803fd8 - alloc::vec::Vec<T,A>::remove::h1260f54250db1bea
  13:        0x1057b975c - nu_protocol::value::Value::remove_data_at_cell_path::hca2fbf8a800d10b1
  14:        0x105354470 - <nu_command::filters::reject::Reject as nu_protocol::engine::command::Command>::run::h64c9b3c1862ce168
  15:        0x105448008 - nu_engine::eval::eval_call::h1d6297f98c1bb0c2
  16:        0x10544db14 - nu_engine::eval::eval_expression_with_input::h7198fc906840f335
  17:        0x10544deac - nu_engine::eval::eval_element_with_input::hdf3e6ff08bdd4d60
  18:        0x10544eed0 - nu_engine::eval::eval_block::h7f9cea5d920976f4
  19:        0x105067b08 - nu_cli::util::eval_source::hb61875245d503b14
  20:        0x10505cd1c - nu_cli::repl::evaluate_repl::hcbc431f530922a6b
  21:        0x10502f5c8 - nu::run::run_repl::h96641cf090ec8c85
  22:        0x10502bdf0 - nu::main::h7f4d393ad5773a41
  23:        0x10502c5ac - std::sys_common::backtrace::__rust_begin_short_backtrace::h830d8936238103b5
  24:        0x10502fa38 - std::rt::lang_start::{{closure}}::h6f851bec03fc2eb2
  25:        0x1059ddc5c - std::rt::lang_start_internal::h35d2d45ea8360422
  26:        0x10502c44c - _main

How to reproduce

[[a, a]; [1, 2]] | reject a

Expected behavior

I expected nu to not panic.

Screenshots

No response

Configuration

key value
version 0.76.0
branch
commit_hash
build_os macos-aarch64
build_target aarch64-apple-darwin
rust_version rustc 1.67.1 (d5a82bbd2 2023-02-07) (built from a source tarball)
cargo_version cargo 1.67.0 (8ecd4f20a 2023-01-10)
pkg_version 0.76.0
build_time 2023-02-21 20:46:29 +00:00
build_rust_channel release
features database, default, trash, which, zip
installed_plugins

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions