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

crash when using the --cheatsh option #703

Closed
lacygoill opened this issue Mar 10, 2022 · 5 comments
Closed

crash when using the --cheatsh option #703

lacygoill opened this issue Mar 10, 2022 · 5 comments

Comments

@lacygoill
Copy link

Describe the bug

navi crashes when using the --cheatsh option.

To Reproduce

Run this shell command:

navi --cheatsh find

Press the Up arrow key to select the previous suggestion: navi crashes.

Expected behavior

navi doesn't crash.

Screenshots

N/A

Versions:

  • OS: Ubuntu 20.04
  • Shell Version: zsh 5.8

Additional context

Here is a backtrace:

stack backtrace:
   0:     0x558b8f241ef6 - std::backtrace_rs::backtrace::libunwind::trace::hf2f6aa11f15afae5
                               at /build/rustc-6496Ax/rustc-1.57.0+dfsg1+llvm/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
   1:     0x558b8f241ef6 - std::backtrace_rs::backtrace::trace_unsynchronized::hfc44a6226fb5d219
                               at /build/rustc-6496Ax/rustc-1.57.0+dfsg1+llvm/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x558b8f241ef6 - std::sys_common::backtrace::_print_fmt::h70bd032f952cf459
                               at /build/rustc-6496Ax/rustc-1.57.0+dfsg1+llvm/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x558b8f241ef6 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h49e1a23a5054c758
                               at /build/rustc-6496Ax/rustc-1.57.0+dfsg1+llvm/library/std/src/sys_common/backtrace.rs:46:22
   4:     0x558b8f27615c - core::fmt::write::h182b3dab33fa727d
                               at /build/rustc-6496Ax/rustc-1.57.0+dfsg1+llvm/library/core/src/fmt/mod.rs:1163:17
   5:     0x558b8f22f775 - std::io::Write::write_fmt::h5ea7b9894bff0939
                               at /build/rustc-6496Ax/rustc-1.57.0+dfsg1+llvm/library/std/src/io/mod.rs:1696:15
   6:     0x558b8f2302a0 - std::sys_common::backtrace::_print::hb75c2175482624d1
                               at /build/rustc-6496Ax/rustc-1.57.0+dfsg1+llvm/library/std/src/sys_common/backtrace.rs:49:5
   7:     0x558b8f2302a0 - std::sys_common::backtrace::print::h335deda6566a1328
                               at /build/rustc-6496Ax/rustc-1.57.0+dfsg1+llvm/library/std/src/sys_common/backtrace.rs:36:9
   8:     0x558b8f2302a0 - std::panicking::default_hook::{{closure}}::h6173da6e0942ed8a
                               at /build/rustc-6496Ax/rustc-1.57.0+dfsg1+llvm/library/std/src/panicking.rs:210:50
   9:     0x558b8f22fe41 - std::panicking::default_hook::h611c2dce9a02b0de
                               at /build/rustc-6496Ax/rustc-1.57.0+dfsg1+llvm/library/std/src/panicking.rs:227:9
  10:     0x558b8f2308eb - std::panicking::rust_panic_with_hook::h00e530dc19739cc5
                               at /build/rustc-6496Ax/rustc-1.57.0+dfsg1+llvm/library/std/src/panicking.rs:624:17
  11:     0x558b8f2423e0 - std::panicking::begin_panic_handler::{{closure}}::h0f0f2898d10c9bce
                               at /build/rustc-6496Ax/rustc-1.57.0+dfsg1+llvm/library/std/src/panicking.rs:521:13
  12:     0x558b8f242044 - std::sys_common::backtrace::__rust_end_short_backtrace::hf8ad41e55ac21c53
                               at /build/rustc-6496Ax/rustc-1.57.0+dfsg1+llvm/library/std/src/sys_common/backtrace.rs:139:18
  13:     0x558b8f230392 - rust_begin_unwind
                               at /build/rustc-6496Ax/rustc-1.57.0+dfsg1+llvm/library/std/src/panicking.rs:517:5
  14:     0x558b8f0d9231 - core::panicking::panic_fmt::hbfd18ed1d8ed03e1
                               at /build/rustc-6496Ax/rustc-1.57.0+dfsg1+llvm/library/core/src/panicking.rs:100:14
  15:     0x558b8f0d9724 - core::str::slice_error_fail::h1443d180f74c7362
  16:     0x558b8f112812 - navi::parser::read_lines::h00b2492a1a364236
  17:     0x558b8f10f574 - <navi::cheatsh::Fetcher as navi::structures::fetcher::Fetcher>::fetch::h6b8b8e6e7aafa5e0
  18:     0x558b8f0fa357 - <navi::finder::FinderChoice as navi::finder::Finder>::call::hcffda464883539fc
  19:     0x558b8f10be1d - navi::handler::core::main::h5c3b8e57ec243532
  20:     0x558b8f0d9bb7 - navi::main::h6bc4c6f9c7602a90
  21:     0x558b8f0d98b3 - std::sys_common::backtrace::__rust_begin_short_backtrace::h5bb5f1ae7f0dd769
  22:     0x558b8f0d9a1d - std::rt::lang_start::{{closure}}::h62e177874118561b
  23:     0x558b8f22b8d1 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::h40ff753a84ffa5fb
                               at /build/rustc-6496Ax/rustc-1.57.0+dfsg1+llvm/library/core/src/ops/function.rs:259:13
  24:     0x558b8f22b8d1 - std::panicking::try::do_call::h18ca85146b2c97eb
                               at /build/rustc-6496Ax/rustc-1.57.0+dfsg1+llvm/library/std/src/panicking.rs:403:40
  25:     0x558b8f22b8d1 - std::panicking::try::he1f6b82ce0566f45
                               at /build/rustc-6496Ax/rustc-1.57.0+dfsg1+llvm/library/std/src/panicking.rs:367:19
  26:     0x558b8f22b8d1 - std::panic::catch_unwind::h305fd36a040bbd45
                               at /build/rustc-6496Ax/rustc-1.57.0+dfsg1+llvm/library/std/src/panic.rs:133:14
  27:     0x558b8f22b8d1 - std::rt::lang_start_internal::{{closure}}::h978c2fbb45d5a4b4
                               at /build/rustc-6496Ax/rustc-1.57.0+dfsg1+llvm/library/std/src/rt.rs:128:48
  28:     0x558b8f22b8d1 - std::panicking::try::do_call::h8123cbc0366d0ace
                               at /build/rustc-6496Ax/rustc-1.57.0+dfsg1+llvm/library/std/src/panicking.rs:403:40
  29:     0x558b8f22b8d1 - std::panicking::try::h821570f729a702fd
                               at /build/rustc-6496Ax/rustc-1.57.0+dfsg1+llvm/library/std/src/panicking.rs:367:19
  30:     0x558b8f22b8d1 - std::panic::catch_unwind::hc178b81e7693b509
                               at /build/rustc-6496Ax/rustc-1.57.0+dfsg1+llvm/library/std/src/panic.rs:133:14
  31:     0x558b8f22b8d1 - std::rt::lang_start_internal::h64a8327b226752c1
                               at /build/rustc-6496Ax/rustc-1.57.0+dfsg1+llvm/library/std/src/rt.rs:128:20
  32:     0x558b8f0d9cb2 - main
  33:     0x7fe6aca800b3 - __libc_start_main
  34:     0x558b8f0d97ee - _start
  35:                0x0 - <unknown>
@welcome
Copy link

welcome bot commented Mar 10, 2022

Thanks for opening your first issue here! In case you're facing a bug, please update navi to the latest version first. Maybe the bug is already solved! :)

@lacygoill
Copy link
Author

In case you're facing a bug, please update navi to the latest version first.

I reproduced the crash in a docker container after compiling from source on commit 537e2d6


I'm also on the currently latest commit for fzf:

$ fzf --version
0.29.0 (dc975e8)

@denisidoro
Copy link
Owner

navi --cheatsh ls  

works fine while

navi --cheatsh find  

doesn't

The output of

curl cheat.sh/find

probably has some character combination that is confusing navi

@denisidoro
Copy link
Owner

denisidoro commented Mar 11, 2022

This seems to be the offending part, but I'm not exactly sure why:

# The above is a useful demonstration of some pitfalls into which a user can
# fall, where the below is the above but corrected. Here is why:
#
#   * The `.` (current working directory) is assumed when no path is provided.
#   * Group syntax (parentheses) was used, but nothing was actually grouped.
#   * A lot of people have their ls(1) command aliased in many ways, -
#     potentially causing problems with the output and how xargs(1) handles it.
#     By escaping the command, we temporarily override any aliases and even
#     functions by the same name.
#   * At least in my experience, the prior xargs(1) is not as reliable.
#   * The `-print0` and `xargs -0` is great, but unnecessary (except when?).
#
# However, it might be more preferred to simply use find(1)'s own `-printf`
# flag, in order to avoid the need for xargs(1) and ls(1), which should be many
# times faster, and allows for more specificity.
find -perm -4000 -type f -print0 | xargs -I '{}' -0 \ls -l '{}'

@denisidoro
Copy link
Owner

Seems to be working in the master branch:

shot 2023-04-08 at 21 02 31

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants