asdf-vm / asdf-vm/asdf

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

Open
#1,130 1 comment 2 reactions 0 assignees View on GitHub
enhancement help wanted priority
Dominant language
Go
Stars
25.6k
Forks
941
Avg merge
9h 24m
Merged PRs (30d)
3

Description

### 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?
```
6. install a version via asdf `$asdf install direnv 2.28.0`
7. it can now find the system version
```
$asdf which direnv
/opt/homebrew/bin/direnv
```
8. 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

```shell
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.

Contributor guide

Open the contributing guide

Research direction

The reported entry points are `asdf which` and `asdf exec`; reproduce the system-version case with the asdf-direnv plugin and the `.tool-versions` setting described. Trace whether core or the plugin handles a `system` selection, then verify that both commands resolve the system executable before any asdf-managed version is installed.

Written by the indexing model from the issue text.

Assessment

Tech stack
shell
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.