marlonrichert / zsh-snap

⚡️ Znap! Fast, easy-to-use tools for Zsh dotfiles & plugins, plus git repos
MIT License
1.32k stars 38 forks source link

`znap restart` breaks `asdf` #234

Closed yozachar closed 1 year ago

yozachar commented 1 year ago

Describe the bug

znap restart breaks asdf

Steps To Reproduce

.zshrc ```zsh # If not running interactively, do nothing [[ $- != *i* ]] && return # Zsh HISTFILE=~/.zsh_history HISTSIZE=100000 SAVEHIST=$HISTSIZE setopt append_history # append rather then overwrite setopt inc_append_history # add history immediately after typing a command export EDITOR=micro export GCM_CREDENTIAL_STORE=secretservice # aliases alias ls='LC_ALL=C ls -h --group-directories-first --color=auto' alias which='whence -p' # keybindings source ~/.zsh_keybindings # Download Znap, if it's not there yet. [[ -f ~/.znap/src/znap.zsh ]] || git clone --depth 1 -- https://github.com/marlonrichert/zsh-snap.git ~/.znap/src # Set znap repo directory zstyle ':znap:*' repos-dir ~/.znap/repos # source znap source ~/.znap/src/znap.zsh # tools #znap install asdf-vm/asdf #znap install andreafrancia/trash-cli #znap install refi64/stylepak # zsh-snap plugins znap source asdf-vm/asdf asdf.sh znap source zsh-users/zsh-autosuggestions znap source zsh-users/zsh-syntax-highlighting # asdf asdf reshim znap eval asdf-community/asdf-direnv "asdf exec $( asdf which direnv ) hook zsh" # zsh-snap prompt echo -e "\n$(neofetch)" znap eval starship 'starship init zsh --print-full-init' znap prompt ```

Run znap restart

Expected behavior

Zsh restarts without any problem.

Observed behavior

Restart aborts.

Click to expand ```console Validating dotfiles... Validation failed with the following errors: /home/user-name/.local/bin/asdf: line 4: /home/user-name/.local/lib/utils.bash: No such file or directory /home/user-name/.local/bin/asdf: line 72: asdf_default_tool_versions_filename: command not found /home/user-name/.local/bin/asdf: line 75: asdf_config_file: command not found /home/user-name/.local/bin/asdf: line 78: asdf_data_dir: command not found /home/user-name/.local/bin/asdf: line 81: asdf_dir: command not found /home/user-name/.local/bin/asdf: line 27: asdf_dir: command not found /home/user-name/.local/bin/asdf: line 101: asdf_dir: command not found Unknown command: `asdf reshim` /home/user-name/.local/bin/asdf: line 103: /lib/commands/command-help.bash: No such file or directory /home/user-name/.local/bin/asdf: line 4: /home/user-name/.local/lib/utils.bash: No such file or directory /home/user-name/.local/bin/asdf: line 72: asdf_default_tool_versions_filename: command not found /home/user-name/.local/bin/asdf: line 75: asdf_config_file: command not found /home/user-name/.local/bin/asdf: line 78: asdf_data_dir: command not found /home/user-name/.local/bin/asdf: line 81: asdf_dir: command not found /home/user-name/.local/bin/asdf: line 27: asdf_dir: command not found /home/user-name/.local/bin/asdf: line 101: asdf_dir: command not found Unknown command: `asdf which direnv` /home/user-name/.local/bin/asdf: line 103: /lib/commands/command-help.bash: No such file or directory Restart aborted. ```

Environment:

Additional context

Also please ref: https://github.com/twpayne/chezmoi/issues/2928

yozachar commented 1 year ago

Error does not happens when HEAD is detached in asdf-vm/asdf

$ asdf list
direnv
 *2.32.2
pipx
 *1.2.0
python
  3.11.3
.zshrc ```zsh # If not running interactively, do nothing [[ $- != *i* ]] && return # Zsh HISTFILE=~/.zsh_history HISTSIZE=100000 SAVEHIST=$HISTSIZE setopt append_history # append rather then overwrite setopt inc_append_history # add history immediately after typing a command export EDITOR=micro export GCM_CREDENTIAL_STORE=secretservice # aliases alias ls='LC_ALL=C ls -h --group-directories-first --color=auto' alias which='whence -p' # keybindings source ~/.zsh_keybindings # Download Znap, if it's not there yet. [[ -f ~/.znap/src/znap.zsh ]] || git clone --depth 1 -- https://github.com/marlonrichert/zsh-snap.git ~/.znap/src # Set znap repo directory zstyle ':znap:*' repos-dir ~/.znap/repos # source znap source ~/.znap/src/znap.zsh # tools #znap install asdf-vm/asdf #znap install refi64/stylepak # zsh-snap plugins znap source asdf-vm/asdf asdf.sh znap source zsh-users/zsh-autosuggestions znap source zsh-users/zsh-syntax-highlighting # asdf znap eval asdf-community/asdf-direnv "asdf exec $( asdf which direnv ) hook zsh" #source "${XDG_CONFIG_HOME:-$HOME/.config}/asdf-direnv/zshrc" # zsh-snap prompt echo -e "\n$(neofetch)" znap eval starship 'starship init zsh --print-full-init' znap prompt ```
$ znap pull
asdf no upstream
asdf-direnv ✓
stylepak ✓
zsh-autosuggestions ✓
zsh-syntax-highlighting ✓

$ asdf update --head
From https://github.com/asdf-vm/asdf
 * branch            master     -> FETCH_HEAD
Previous HEAD position was 0adc6c1 chore(master): release 0.11.3 (#1498)
Switched to branch 'master'
Your branch is up to date with 'origin/master'.
HEAD is now at f273612 fix: improve readability of the non-set `nullglob` guard (#1545)
Updated asdf to latest on the master branch

$ znap pull
asdf ✓
asdf-direnv ✓
stylepak ✓
zsh-autosuggestions ✓
zsh-syntax-highlighting ✓

$ znap restart
Validating dotfiles...
Validation failed with the following errors:
/home/user-name/.local/bin/asdf: line 4: /home/user-name/.local/lib/utils.bash: No such file or directory
/home/user-name/.local/bin/asdf: line 72: asdf_default_tool_versions_filename: command not found
/home/user-name/.local/bin/asdf: line 75: asdf_config_file: command not found
/home/user-name/.local/bin/asdf: line 78: asdf_data_dir: command not found
/home/user-name/.local/bin/asdf: line 81: asdf_dir: command not found
/home/user-name/.local/bin/asdf: line 27: asdf_dir: command not found
/home/user-name/.local/bin/asdf: line 101: asdf_dir: command not found
Unknown command: `asdf reshim`
/home/user-name/.local/bin/asdf: line 103: /lib/commands/command-help.bash: No such file or directory
/home/user-name/.local/bin/asdf: line 4: /home/user-name/.local/lib/utils.bash: No such file or directory
/home/user-name/.local/bin/asdf: line 72: asdf_default_tool_versions_filename: command not found
/home/user-name/.local/bin/asdf: line 75: asdf_config_file: command not found
/home/user-name/.local/bin/asdf: line 78: asdf_data_dir: command not found
/home/user-name/.local/bin/asdf: line 81: asdf_dir: command not found
/home/user-name/.local/bin/asdf: line 27: asdf_dir: command not found
/home/user-name/.local/bin/asdf: line 101: asdf_dir: command not found
Unknown command: `asdf which direnv`
/home/user-name/.local/bin/asdf: line 103: /lib/commands/command-help.bash: No such file or directory
Restart aborted.

$ asdf update
asdf update       
Note: switching to 'v0.11.3'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at 0adc6c1 chore(master): release 0.11.3 (#1498)
Updated asdf to release v0.11.3

$ znap pull
asdf no upstream
asdf-direnv ✓
stylepak ✓
zsh-autosuggestions ✓
zsh-syntax-highlighting ✓

$ znap restart
Validating dotfiles...
Restarting Zsh...

$