voku / dotfiles

:bookmark_tabs: .dotfiles for Bash (Linux) / ZSH (Linux) / Git Bash (Windows) / Cygwin (Windows) / Bash on Ubuntu on Windows
MIT License
214 stars 49 forks source link

Entering git repo throws "Cannot find gitstatus.sh" #38

Open serpro69 opened 5 years ago

serpro69 commented 5 years ago

Not sure what this is. Had this error once before, couldn't find the culprit and had to do clean install. Now after a few days of using the dotfiles again seeing this error.

Re-running bootstrap.sh did not help. The file is clearly present in the /bin folder, however still getting this error.

Oh, and thanks for these awesome dotfiles!

Upd: I've noticed my shell got switched back to bash instead of zsh. Switching to zsh made the issue disappear. But should this work under bash shell as well?

voku commented 5 years ago

can you please run echo $PATH in the bash and post the result here, thanks. The file should be in the ~/bin/ directory not in /bin/.

serpro69 commented 5 years ago

Here's the difference between path variables in zsh and bash:

✓ ~→ bash                                                                                                                                                                                                                                                                                                           
✓ ~→ echo $PATH
/usr/local/bin:/usr/sbin:/sbin:/usr/local/sbin:/home/sergio/bin:/usr/local/bin:/usr/sbin:/sbin:/usr/local/sbin:/home/sergio/bin:/usr/local/bin:/usr/sbin:/sbin:/usr/local/sbin:/home/sergio/bin:/usr/local/bin:/usr/sbin:/sbin:/usr/local/sbin:/home/sergio/bin:/home/sergio/.local/bin:/home/sergio/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/sergio/.local/bin:/home/sergio/.local/bin:/home/sergio/.local/bin:/home/sergio/.local/bin

✓ ~→ zsh
✓ ~→ echo $PATH
/usr/local/bin:/usr/sbin:/sbin:/usr/local/sbin:/home/sergio/bin:/usr/local/bin:/usr/sbin:/sbin:/usr/local/sbin:/home/sergio/bin:/usr/local/bin:/usr/sbin:/sbin:/usr/local/sbin:/home/sergio/bin:/usr/local/bin:/usr/sbin:/sbin:/usr/local/sbin:/home/sergio/bin:/usr/local/bin:/usr/sbin:/sbin:/usr/local/sbin:/home/sergio/bin:/home/sergio/.local/bin:/home/sergio/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/sergio/.local/bin:/home/sergio/.local/bin:/home/sergio/.local/bin:/home/sergio/.local/bin:/home/sergio/.local/bin

The file was present in the ~/bin directory, I checked that. Also it was on the path because I could just call $ gitstatus.sh from anywhere.

✓ ~→ cd dotfiles                                                                                                                                                                                                                                                                                                    
✓ ~/dotfiles→ bash # switching to bash in a repo, and getting the error message right away                                                                                                                                                                                                                                                                                                 
Cannot find gitstatus.sh!
Cannot find gitstatus.sh!
sergio@milleniumfalcon:~/dotfiles$ gitstatus # can still see the script on the path with autocomplete and execute it
gitstatus_pre-1.7.10.sh  gitstatus.py             gitstatus.sh             
sergio@milleniumfalcon:~/dotfiles$  zsh # changing back to zsh - no error 
✓ ~/dotfiles→
GersonDias commented 5 years ago

Hey, I found the same issue running that on WSL

here is my $PATH after running bootstrap.sh

/usr/local/bin:/usr/sbin:/sbin:/usr/local/sbin:/home/gersondias/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/ProgramData/DockerDesktop/version-bin:/mnt/c/Program Files/Docker/Docker/Resources/bin:/mnt/c/Python37/Scripts/:/mnt/c/Python37/:/mnt/c/Program Files (x86)/Microsoft SDKs/Azure/CLI2/wbin:/mnt/c/Program Files (x86)/Intel/iCLS Client/:/mnt/c/Program Files/Intel/iCLS Client/:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files/Microsoft VS Code/bin:/mnt/c/Program Files/dotnet/:/mnt/c/Program Files/Microsoft SQL Server/130/Tools/Binn/:/mnt/c/Program Files/Microsoft SQL Server/Client SDK/ODBC/170/Tools/Binn/:/mnt/c/ProgramData/chocolatey/bin:/mnt/c/Program Files/PowerShell/6/:/mnt/c/Program Files/Git/cmd:/mnt/c/Program Files (x86)/vim/vim80:/mnt/c/Program Files/nodejs/:/mnt/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/MSBuild/Current/Bin:/mnt/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/ide/Extensions/TestPlatform:/mnt/c/Users/GersonDias/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/GersonDias/AppData/Roaming/npm:/mnt/c/tools/Cmder:/mnt/c/Users/GersonDias/.dotnet/tools:/snap/bin  
serpro69 commented 5 years ago

I personally didn't look into it yet, though I have a feeling that it has to do with .redpill files, specifically the bash setup. But I don't have much time ATM to debug this, and I also use zsh, so I don't encounter this issue unless I explicitly switch back to bash shell.

roaldjap commented 4 years ago

Hey, I found the same issue running that on WSL

here is my $PATH after running bootstrap.sh

/usr/local/bin:/usr/sbin:/sbin:/usr/local/sbin:/home/gersondias/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/ProgramData/DockerDesktop/version-bin:/mnt/c/Program Files/Docker/Docker/Resources/bin:/mnt/c/Python37/Scripts/:/mnt/c/Python37/:/mnt/c/Program Files (x86)/Microsoft SDKs/Azure/CLI2/wbin:/mnt/c/Program Files (x86)/Intel/iCLS Client/:/mnt/c/Program Files/Intel/iCLS Client/:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files/Microsoft VS Code/bin:/mnt/c/Program Files/dotnet/:/mnt/c/Program Files/Microsoft SQL Server/130/Tools/Binn/:/mnt/c/Program Files/Microsoft SQL Server/Client SDK/ODBC/170/Tools/Binn/:/mnt/c/ProgramData/chocolatey/bin:/mnt/c/Program Files/PowerShell/6/:/mnt/c/Program Files/Git/cmd:/mnt/c/Program Files (x86)/vim/vim80:/mnt/c/Program Files/nodejs/:/mnt/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/MSBuild/Current/Bin:/mnt/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/ide/Extensions/TestPlatform:/mnt/c/Users/GersonDias/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/GersonDias/AppData/Roaming/npm:/mnt/c/tools/Cmder:/mnt/c/Users/GersonDias/.dotnet/tools:/snap/bin  

I have the same issue on WSL. Have you found any solutions @GersonDias ?

roaldjap commented 4 years ago

On wsl, I managed to prevent throwing "Cannot find gitstatus.sh" by executing zsh on your bash shell. by default, wsl runs bash shell. try also running chsh -s $(which zsh) to change your shell default.

raelik commented 2 years ago

I fixed this issue by copying bin/gitstatush.sh into .redpill/bash_prompt/. The problem is fairly obvious when you look at the code starting at line 9 in gitprompt.sh:

function git_prompt_dir() {                                                      
  # assume the gitstatus.sh is in the same directory as this script                                 
  # code thanks to http://stackoverflow.com/questions/59895                      
  if [ -z "$__GIT_PROMPT_DIR_BASH" ]; then                                       
    local SOURCE="${BASH_SOURCE[0]}"                                             
    while [ -h "$SOURCE" ]; do                                                   
      local DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"                     
      SOURCE="$(readlink "$SOURCE")"                                             
      [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"                               
    done                                                                         
    __GIT_PROMPT_DIR_BASH="$( cd -P "$( dirname "$SOURCE" )" && pwd )"           
  fi                                                                             
} 

The comment says it all. The code assumes that gitstatus.sh is in the same directory with gitprompt.sh