flamegraph-rs / flamegraph

Easy flamegraphs for Rust projects and everything else, without Perl or pipes <3

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fails to load `zsh` completions

vic1707 opened this issue · comments

Hello,

First, thanks for this fantastic tool!

Unfortunately, flamegraph's zsh completions cannot load properly.

  zsh ❯ eval "$(flamegraph --completions zsh)"
_arguments:comparguments:325: can only be called from completion function

Running:

flamegraph 0.6.2
zsh 5.8.1 (x86_64-apple-darwin22.0)
rustc 1.69.0 (84c898d65 2023-04-16)

It may be due to clap_complete being on 4.0.2 (the latest being 4.2.2), but I'm not sure.

If you need any other information, please tell me.

I just published 0.6.3, can you see if it still has this problem?

just tested, unfortunately it now cashes 😓

thread 'main' panicked at 'Command flamegraph: Argument or group 'trailing-arguments' specified in 'conflicts_with*' for 'completions' does not exist', /Users/vic1707/.cargo/registry/src/github.com-1ecc6299db9ec823/clap_builder-4.2.7/src/builder/debug_asserts.rs:217:13
stack backtrace:
   0: rust_begin_unwind
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:579:5
   1: core::panicking::panic_fmt
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/panicking.rs:64:14
   2: clap_builder::builder::debug_asserts::assert_app
             at /Users/vic1707/.cargo/registry/src/github.com-1ecc6299db9ec823/clap_builder-4.2.7/src/builder/debug_asserts.rs:217:13
   3: clap_builder::builder::command::Command::_build_self
             at /Users/vic1707/.cargo/registry/src/github.com-1ecc6299db9ec823/clap_builder-4.2.7/src/builder/command.rs:3917:13
   4: clap_builder::builder::command::Command::_do_parse
             at /Users/vic1707/.cargo/registry/src/github.com-1ecc6299db9ec823/clap_builder-4.2.7/src/builder/command.rs:3787:9
   5: clap_builder::builder::command::Command::try_get_matches_from_mut
             at /Users/vic1707/.cargo/registry/src/github.com-1ecc6299db9ec823/clap_builder-4.2.7/src/builder/command.rs:723:9
   6: clap_builder::builder::command::Command::get_matches_from
             at /Users/vic1707/.cargo/registry/src/github.com-1ecc6299db9ec823/clap_builder-4.2.7/src/builder/command.rs:591:9
   7: clap_builder::builder::command::Command::get_matches
             at /Users/vic1707/.cargo/registry/src/github.com-1ecc6299db9ec823/clap_builder-4.2.7/src/builder/command.rs:500:9
   8: clap_builder::derive::Parser::parse
             at /Users/vic1707/.cargo/registry/src/github.com-1ecc6299db9ec823/clap_builder-4.2.7/src/derive.rs:27:27
   9: flamegraph::main
             at ./src/bin/flamegraph.rs:31:15
  10: core::ops::function::FnOnce::call_once
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
RUST_BACKTRACE=full flamegraph --completions zsh
thread 'main' panicked at 'Command::get_arg_conflicts_with: The passed arg conflicts with an arg unknown to the cmd', /Users/vic1707/.cargo/registry/src/github.com-1ecc6299db9ec823/clap_builder-4.2.7/src/builder/command.rs:3495:21
stack backtrace:
   0:        0x1004e5828 - std::backtrace_rs::backtrace::libunwind::trace::h2000fb4d08dbcc59
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:        0x1004e5828 - std::backtrace_rs::backtrace::trace_unsynchronized::h2b5e61495350674d
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:        0x1004e5828 - std::sys_common::backtrace::_print_fmt::h05f5bfbdb3415936
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/sys_common/backtrace.rs:65:5
   3:        0x1004e5828 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h105074e3d85f800b
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/sys_common/backtrace.rs:44:22
   4:        0x1004ff774 - core::fmt::write::h34766cf8fff7af1e
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/fmt/mod.rs:1232:17
   5:        0x1004e327c - std::io::Write::write_fmt::hd64c4cf6e7adea59
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/io/mod.rs:1684:15
   6:        0x1004e563c - std::sys_common::backtrace::_print::hd92783a665d3ebfb
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/sys_common/backtrace.rs:47:5
   7:        0x1004e563c - std::sys_common::backtrace::print::h2a6828a537036cf9
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/sys_common/backtrace.rs:34:9
   8:        0x1004e6d9c - std::panicking::default_hook::{{closure}}::h4e82ce6ccef941b2
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:271:22
   9:        0x1004e6af4 - std::panicking::default_hook::h29f62f8795c5cb00
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:290:9
  10:        0x1004e72ac - std::panicking::rust_panic_with_hook::h19862cbd0fbda7ba
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:692:13
  11:        0x1004e71a0 - std::panicking::begin_panic_handler::{{closure}}::h3f3626935e1669fe
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:581:13
  12:        0x1004e5c48 - std::sys_common::backtrace::__rust_end_short_backtrace::h5054ef52bd507d0a
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/sys_common/backtrace.rs:150:18
  13:        0x1004e6f3c - rust_begin_unwind
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:579:5
  14:        0x10050f78c - core::panicking::panic_fmt::h7e47e10600a90221
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/panicking.rs:64:14
  15:        0x1004af0ec - clap_builder::builder::command::Command::get_arg_conflicts_with::h380c64127700038b
  16:        0x100481d4c - clap_complete::shells::zsh::arg_conflicts::h99283135b281c622
  17:        0x10047f730 - clap_complete::shells::zsh::get_args_of::hdb7ee8143f444740
  18:        0x10047e23c - <clap_complete::shells::zsh::Zsh as clap_complete::generator::Generator>::generate::hbeaf9160646231da
  19:        0x100420a18 - flamegraph::main::h18255bf6d03124f3
  20:        0x1004188f4 - std::sys_common::backtrace::__rust_begin_short_backtrace::he2737375fd29e86f
  21:        0x10041e4d8 - std::rt::lang_start::{{closure}}::h160555670104bcc1
  22:        0x1004de258 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::hf2f6b444963da11f
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/ops/function.rs:287:13
  23:        0x1004de258 - std::panicking::try::do_call::h9152231fddd58858
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:487:40
  24:        0x1004de258 - std::panicking::try::hcc27eab3b8ee3cb1
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:451:19
  25:        0x1004de258 - std::panic::catch_unwind::hca546a4311ab9871
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panic.rs:140:14
  26:        0x1004de258 - std::rt::lang_start_internal::{{closure}}::h4e65aa71fe685c85
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/rt.rs:148:48
  27:        0x1004de258 - std::panicking::try::do_call::h61aea55fbdf97fc2
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:487:40
  28:        0x1004de258 - std::panicking::try::hcfc3b62fb8f6215e
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:451:19
  29:        0x1004de258 - std::panic::catch_unwind::h61a201e98b56a743
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panic.rs:140:14
  30:        0x1004de258 - std::rt::lang_start_internal::h91996717d3eb1d2a
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/rt.rs:148:20
  31:        0x100421ed8 - _main

the completion export works (or at least doesn't crash) but not the completions themselves.
I'll try to see if I can fix that

for now spamming tab just result in nothing being shown

  • no completion list
  • no local files (default behavior when no completions exist)

so it might be clap_complete's output that’s buggy

with 0.6.4, zsh completions can now be generated without crashes but nothing shows up when spamming Tab 😕

Well, I maybe ask the clap folks about this?

Maybe, to be fair, I don't know why it's not working 😕