asdf-vm/asdf

bug: asdf crashes when run from a symlink

cornfeedhobo opened this issue · 3 comments

Describe the Bug

asdf makes heavy use of $(dirname "$(dirname "$0")") to resolve script location. This fails in the case of being run from a symlinked location.

Steps to Reproduce

  1. mkdir ~/.local/bin
  2. export PATH="${HOME}/.local/bin:${PATH}"
  3. git clone https://github.com/asdf-vm/asdf.git ~/.asdf
  4. cd ~/.local/bin
  5. ln -s ~/.asdf/bin/asdf asdf

Expected Behaviour

I expect asdf to gracefully discover it's real root directory

Actual Behaviour

asdf: line 5: /home/cornfeedhobo/.local/bin/lib/utils.bash: No such file or directory
asdf: line 71: asdf_tool_versions_filename: command not found
asdf: line 74: asdf_config_file: command not found
asdf: line 77: asdf_data_dir: command not found
asdf: line 80: asdf_dir: command not found
asdf: line 28: asdf_dir: command not found
asdf: line 113: asdf_dir: command not found
asdf: line 116: /lib/commands/command-help.bash: No such file or directory

Environment

asdf can't run, so no info right now

asdf plugins affected (if relevant)

No response

This is not the correct way to install asdf - see the website to see how to properly install asdf

It would be good to print a warning (and exit) in this case, even if it's the incorrect instalation procedure

@hyperupcall I've already got a branch up to fix this. I've seen it in pyenv and goenv. This makes it much easier for distro package maintainers.