asdf icon indicating copy to clipboard operation
asdf copied to clipboard

shim hardcodes ASDF_DATA_DIR

Open mcarifio opened this issue 3 years ago • 1 comments

Is your feature request related to a problem? Please describe

Thank you for asdf. I use it on all my machines.

If I move my asdf directory currently at /mopt/asdf/current to another location, all the shims in /mopt/asdf/current/shims have hardcoded paths.

Describe the proposed solution

Easier to describe with an example.

Instead of:

#!/usr/bin/env bash
# asdf-plugin: direnv 2.28.0
exec /mopt/asdf/current/bin/asdf exec "direnv" "$@"

I think I should see:

#!/usr/bin/env bash
# asdf-plugin: direnv 2.28.0
exec ${ASDF_DATA_DIR:-/mopt/asdf/current}/bin/asdf exec "direnv" "$@"

If I move my directory elsewhere and redefine the new ASDF_DATA_DIR, it will all work (maybe).

Describe similar asdf features and why they are not sufficient

There might be a recipe to do this with asdf reshim. I haven't found it.

Describe other workarounds you've considered

For now I make a symbolic link from the old location to the new one. Then the hardcoded pathnames work.

mcarifio avatar Dec 13 '21 17:12 mcarifio

This has significant risks, as its impossible to tell if a particular app hard codes its installation path during compilation.

vim is a perfect example, where .asdf/installs/vim/8.2.xxxx/share/vim is a hard coded part of the binary.

Your plan to move the applications folder will only work if a link is put in place which redirects the original asdf/installs folder. In which case the shim will continue working without changes.

systemmonkey42 avatar Dec 13 '21 23:12 systemmonkey42