cantino / mcfly

Fly through your shell history. Great Scott!
MIT License
6.87k stars 177 forks source link

mcfly not starting #93

Closed mtekp closed 4 years ago

mtekp commented 4 years ago

While mcfly said to wait for 2 minutes, I did wait but seemed it had stuck so I opened another terminal window, I got some error like db locked or something. Then onwards I just see errors, for any command.

❯ export RUST_BACKTRACE=full
McFly: Upgrading McFly DB to version 3, please wait...thread 'main' panicked at 'McFly error: Unable to add cmd_tpl to commands (duplicate column name: cmd_tpl)', /home/manjunath/.cargo/registry/src/github.com-1ecc6299db9ec823/mcfly-0.4.0/src/history/schema.rs:41:17
stack backtrace:
   0:     0x55e0a0eaf795 - backtrace::backtrace::libunwind::trace::h812748238d609e46
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/libunwind.rs:86
   1:     0x55e0a0eaf795 - backtrace::backtrace::trace_unsynchronized::h7c97e818aebf09c8
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/mod.rs:66
   2:     0x55e0a0eaf795 - std::sys_common::backtrace::_print_fmt::h60d914263b0ccd71
                               at src/libstd/sys_common/backtrace.rs:78
   3:     0x55e0a0eaf795 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hf78227137afc7565
                               at src/libstd/sys_common/backtrace.rs:59
   4:     0x55e0a0ded4bc - core::fmt::write::h543cdf60775f89bf
                               at src/libcore/fmt/mod.rs:1069
   5:     0x55e0a0eaee34 - std::io::Write::write_fmt::h0c7f3ce24c679426
                               at src/libstd/io/mod.rs:1504
   6:     0x55e0a0eae635 - std::sys_common::backtrace::_print::h80e55e24be231368
                               at src/libstd/sys_common/backtrace.rs:62
   7:     0x55e0a0eae635 - std::sys_common::backtrace::print::h3b197b9c1261c865
                               at src/libstd/sys_common/backtrace.rs:49
   8:     0x55e0a0eae635 - std::panicking::default_hook::{{closure}}::ha6c807149ce20f8f
                               at src/libstd/panicking.rs:198
   9:     0x55e0a0eadbd1 - std::panicking::default_hook::he49a9c12e358cc45
                               at src/libstd/panicking.rs:218
  10:     0x55e0a0eadbd1 - std::panicking::rust_panic_with_hook::h93f74f5ef2f71f31
                               at src/libstd/panicking.rs:511
  11:     0x55e0a0e24599 - std::panicking::begin_panic::h92dad0d71258ebba
  12:     0x55e0a0e02b4a - mcfly::history::schema::migrate::{{closure}}::hbaa75782e1f66074
  13:     0x55e0a0d85f84 - mcfly::main::h2727542e1c46cc64
  14:     0x55e0a0eb9a63 - std::rt::lang_start_internal::{{closure}}::{{closure}}::h4ed4ab1fb893cc93
                               at src/libstd/rt.rs:52
  15:     0x55e0a0eb9a63 - std::sys_common::backtrace::__rust_begin_short_backtrace::h1f01c818c00c4f70
                               at src/libstd/sys_common/backtrace.rs:130
  16:     0x55e0a0d87182 - main
  17:     0x7f4296892002 - __libc_start_main
  18:     0x55e0a0d7d6ae - _start
  19:                0x0 - <unknown>
cantino commented 4 years ago

Try removing ~/.mcfly/ and letting to process finish. How big is your bash / zsh history file?

mtekp commented 4 years ago

well this worked. My zsh history was 165k. Also the historydb generated is 598k. Is this normal? And after enabling mcfly, I dont see the ctrl-r prompt be like what it is shown in readme.

mtekp commented 4 years ago

I meant not like this git search

cantino commented 4 years ago

What do you see, if not that prompt?

mtekp commented 4 years ago
❯ head ~/.zshrc   
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
source /usr/share/zsh/share/antigen.zsh

if [[ -r ~/.config/mcfly/mcfly.zsh ]]; then
      source ~/.config/mcfly/mcfly.zsh
fi

# Path to your oh-my-zsh installation.
export ZSH="/home/manjunath/.oh-my-zsh"
❯ head  ~/.config/mcfly/mcfly.zsh 
#!/bin/zsh

# Ensure stdin is a tty
[[ -t 0 ]] || return

# Avoid loading this file more than once
if [[ "$__MCFLY_LOADED" == "loaded" ]]; then
  return 0
fi
__MCFLY_LOADED="loaded"

image

left side is mcfly enabled and right is zsh-peco-history enabled

cantino commented 4 years ago

I don't think ~/.config/mcfly/mcfly.zsh is getting sourced. Do you see various MCFLY_ variables set in env?

mtekp commented 4 years ago

❯ echo $MCFLY_
MCFLY_HISTORY     MCFLY_PATH        MCFLY_SESSION_ID

~ via ☕ v11.0.6 
❯ echo $MCFLY_HISTORY 
/tmp/mcfly.Uv1mmSdg
~ via ☕ v11.0.6 
❯ echo $MCFLY_PATH 
/home/manjunath/.cargo/bin/mcfly
~ via ☕ v11.0.6 
❯ echo $MCFLY_SESSION_ID 
eHraNPZHgJCy5nOmUKwlZyyw
mtekp commented 4 years ago

I had sourced something else again later in .zshrc which was causing the problem. Works perfectly fine and great tool I love Rust and love this tool too