asdf icon indicating copy to clipboard operation
asdf copied to clipboard

bug: Unexpected results for ‘system’ versions before installing asdf versions

Open andrewcrook opened this issue 3 years ago • 1 comments

Describe the Bug

Scenario - rollout systems with asdf and basic plugins preinstalled, by default work with the system versions of tools (as set in the config file). allow user(s) to install other versions of tools as and when required

Issue - When I install asdf and its plugins then set the globals to the systems. if I then run, for example, asdf exec direnv status I get the following

asdf exec direnv status
unknown command: direnv. Perhaps you have to reshim? 

I cannot get the command working until I have installed at least one version via asdf. I have seen this behaviour with asdf-python and asdf-direnv plugins (gradually adding more)

I believe it should work with the system versions when no asdf versions are installed I am not sure if this is a bug with each plugin or a bug in the core of asdf itself.

Steps to Reproduce

  1. install asdf
  2. install plugin example asdf-direnv
  3. set global to system - $asdf global direnv system (note: my system version is via homebrew)
  4. check
$asdf current
direnv          system          /Users/andrew/.tool-versions
python          system          /Users/andrew/.tool-versions

5. run commands this shows the issue

$asdf which direnv
unknown command: direnv. Perhaps you have to reshim? 
$asdf exec  direnv status
unknown command: direnv. Perhaps you have to reshim?
  1. install a version via asdf $asdf install direnv 2.28.0
  2. it can now find the system version
$asdf which direnv
/opt/homebrew/bin/direnv
  1. check the asdf version 2.28.0 $asdf global direnv 2.28.0
$asdf which direnv
/Users/andrew/.asdf/installs/direnv/2.28.0/bin/direnv

Expected Behaviour

when no versions are installed by asdf and set to system allow the system version to work through asdf

Actual Behaviour

Doesn’t find any version reshim doesn’t do anything only finds system version if another version is installed via asdf``

Environment

OS:
Darwin Andrews-MBP.local 21.2.0 Darwin Kernel Version 21.2.0: Sun Nov 28 20:29:10 PST 2021; root:xnu-8019.61.5~1/RELEASE_ARM64_T8101 arm64

SHELL:
zsh 5.8 (arm-apple-darwin21.1.0)

ASDF VERSION:
v0.9.0

ASDF ENVIRONMENT VARIABLES:
ASDF_DIR=/opt/homebrew/Cellar/asdf/0.9.0/libexec

ASDF INSTALLED PLUGINS:
direnv                       https://github.com/asdf-community/asdf-direnv.git master 4900445
python                       https://github.com/danhper/asdf-python.git master 57a4d72

asdf plugins affected (if relevant)

ASDF INSTALLED PLUGINS:
direnv                       https://github.com/asdf-community/asdf-direnv.git master 4900445
python                       https://github.com/danhper/asdf-python.git master 57a4d72

Possibly more. As mentioned I am not sure if this is a bug with each plugin or a bug in the core of asdf itself.

andrewcrook avatar Dec 16 '21 16:12 andrewcrook

Hey @andrewcrook thanks for opening this issue. To confirm, this is an issue with the core of asdf itself. Plugins don't get to control the version-resolution process.

I agree that using the system version by default when no other version has been specified is good. However, I don't consider the current behavior to be a bug, but rather a missing feature. I'm updating this issue accordingly. I think this is a feature we should implement for v0.11.0, the next minor version release.

PR is welcome if you want to take a stab at this!

Stratus3D avatar May 27 '22 13:05 Stratus3D