solana-labs / solana

Web-Scale Blockchain for fast, secure, scalable, decentralized apps and marketplaces.
https://solanalabs.com
Apache License 2.0
13.21k stars 4.31k forks source link

Solana command completion - clap bug? 1.18.1 #35175

Open bartenbach opened 9 months ago

bartenbach commented 9 months ago

Generating zsh completion appears broken with 1.18.1

Appears to work for all other shells

% solana --version
solana-cli 1.18.1 (src:5d824a36; feat:756280933, client:SolanaLabs)
~
% RUST_BACKTRACE=full solana completion -s zsh
thread 'main' panicked at /var/lib/buildkite-agent/.cargo/registry/src/index.crates.io-6f17d22bba15001f/clap-2.33.3/src/completions/zsh.rs:407:29:
Fatal internal error. Please consider filing a bug report at https://github.com/clap-rs/clap/issues
stack backtrace:
   0:     0x5792d46210ec - std::backtrace_rs::backtrace::libunwind::trace::ha637c64ce894333a
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x5792d46210ec - std::backtrace_rs::backtrace::trace_unsynchronized::h47f62dea28e0c88d
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x5792d46210ec - std::sys_common::backtrace::_print_fmt::h9eef0abe20ede486
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x5792d46210ec - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hed7f999df88cc644
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x5792d464eea0 - core::fmt::rt::Argument::fmt::h1539a9308b8d058d
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/fmt/rt.rs:142:9
   5:     0x5792d464eea0 - core::fmt::write::h3a39390d8560d9c9
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/fmt/mod.rs:1120:17
   6:     0x5792d461d6ef - std::io::Write::write_fmt::h5fc9997dfe05f882
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/io/mod.rs:1762:15
   7:     0x5792d4620ed4 - std::sys_common::backtrace::_print::h894006fb5c6f3d45
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x5792d4620ed4 - std::sys_common::backtrace::print::h23a2d212c6fff936
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x5792d4622687 - std::panicking::default_hook::{{closure}}::h8a1d2ee00185001a
  10:     0x5792d46223ef - std::panicking::default_hook::h6038f2eba384e475
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:292:9
  11:     0x5792d4622b08 - std::panicking::rust_panic_with_hook::h2b5517d590cab22e
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:779:13
  12:     0x5792d46229ee - std::panicking::begin_panic_handler::{{closure}}::h233112c06e0ef43e
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:657:13
  13:     0x5792d46215b6 - std::sys_common::backtrace::__rust_end_short_backtrace::h6e893f24d7ebbff8
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/sys_common/backtrace.rs:170:18
  14:     0x5792d4622752 - rust_begin_unwind
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:645:5
  15:     0x5792d35c21b5 - core::panicking::panic_fmt::hbf0e066aabfa482c
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/panicking.rs:72:14
  16:     0x5792d35c2173 - core::panicking::panic_display::h68e6012a1c287ca5
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/panicking.rs:178:5
  17:     0x5792d35c2173 - core::panicking::panic_str::h1ca8e3b0d2d70f80
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/panicking.rs:152:5
  18:     0x5792d35c2173 - core::option::expect_failed::h1ae4bac6b7606972
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/option.rs:1985:5
  19:     0x5792d45eae62 - clap::completions::zsh::get_args_of::h1c8c8477259f1152
  20:     0x5792d45e8456 - clap::completions::zsh::get_subcommands_of::hd51e5168d6148b6a
  21:     0x5792d45e851c - clap::completions::zsh::get_subcommands_of::hd51e5168d6148b6a
  22:     0x5792d3753d5c - clap::completions::zsh::ZshGen::generate_to::he362e3161675235f
  23:     0x5792d363f5bd - clap::completions::ComplGen::generate::h463396a01f12b2ff
  24:     0x5792d363f7c0 - clap::app::App::gen_completions_to::he6ab05ffee2274ef
  25:     0x5792d374e608 - solana_cli::cli::parse_command::h1c2ae9cad87f7a49
  26:     0x5792d35c5af8 - solana::main::ha39c51578d5b3ded
  27:     0x5792d35d16c3 - std::sys_common::backtrace::__rust_begin_short_backtrace::h2769ca209530dcd9
  28:     0x5792d35ce721 - std::rt::lang_start::{{closure}}::h26a905f388b14468
  29:     0x5792d4614fa7 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::hd95060ecd5e1ca24
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/ops/function.rs:284:13
  30:     0x5792d4614fa7 - std::panicking::try::do_call::h6e8cf51db32a6e4b
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:552:40
  31:     0x5792d4614fa7 - std::panicking::try::h3a52eefe24fe3c29
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:516:19
  32:     0x5792d4614fa7 - std::panic::catch_unwind::h24c28c23c02c3841
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panic.rs:142:14
  33:     0x5792d4614fa7 - std::rt::lang_start_internal::{{closure}}::h705d3c9cbc06ef47
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/rt.rs:148:48
  34:     0x5792d4614fa7 - std::panicking::try::do_call::ha21f52ba13158470
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:552:40
  35:     0x5792d4614fa7 - std::panicking::try::h5581346bf6aeb1f8
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:516:19
  36:     0x5792d4614fa7 - std::panic::catch_unwind::h7919645a6b72e25b
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panic.rs:142:14
  37:     0x5792d4614fa7 - std::rt::lang_start_internal::h12de51168669836e
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/rt.rs:148:20
  38:     0x5792d35ce70e - std::rt::lang_start::hd05141adb3715638
  39:     0x7be4ef043cd0 - <unknown>
  40:     0x7be4ef043d8a - __libc_start_main
  41:     0x5792d35c29fa - _start
  42:                0x0 - <unknown>
zsh: exit 101   RUST_BACKTRACE=full solana completion -s zsh
jigglu commented 5 months ago

Have you tried patching the clap library

ncoquelet commented 4 months ago

Same here

# solana completion -s zsh
thread 'main' panicked at /var/lib/buildkite-agent/.cargo/registry/src/index.crates.io-6f17d22bba15001f/clap-2.33.3/src/completions/zsh.rs:407:29:
Fatal internal error. Please consider filing a bug report at https://github.com/clap-rs/clap/issues
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
# solana --version        
solana-cli 1.18.17 (src:b685182a; feat:4215500110, client:SolanaLabs)

Why solana-cli depends on this old version of clap ??

zilayo commented 3 months ago

this was fixed back in 2020, but unfortunately it seems solana is still in the process of trying to port to clap v3 (which was deprecated in 2022 and current development is for clap v4)

https://github.com/clap-rs/clap/pull/2191