bug: asdf is shimming things it does not manage
- Dominant language
- Go
- Stars
- 25.6k
- Forks
- 941
- Avg merge
- 9h 24m
- Merged PRs (30d)
- 3
Description
### Describe the Bug
This is a reopening of https://github.com/asdf-vm/asdf/issues/1955#issuecomment-3358434414. Many of us are still experiencing this issue, where asdf is shimming things that it does not manage and causing a lot of headaches. There has been more discussion on that issue since it was closed, but I don't think maintainers are seeing it (because it's closed). So, I'm sorry to do this but this is effectively a "bump" on that issue.
This is related as well: https://github.com/asdf-vm/asdf/issues/2138
### Steps to Reproduce
User installs 2 versions of python using [asdf-python plugin](https://github.com/asdf-community/asdf-python) and sets the python version in a .tool-versions file.
The user then creates and activates a virtual environment. Using pip the user installs a package inside the virtual environment, which contains some executable that asdf shims. The user expects that the executable can be located when they are in the virtual environment:
$ (.venv) which myexecutable
...path/to/.venv/lib/site-packages/mypackage/myexecutable.bin
But upon deactivating the virtual environment, the user expects that the executable should not be found (no myexecutable in... etc). Instead, asdf` takes over:
$ which myexecutable
No version is set for command myexecutable
Consider adding one of the following versions in your config file at /path/to/.tool-versions
The user expects only python or nodejs etc to have this behavior with asdf, but it starts popping up all over their system.
### Expected Behaviour
Do not shim packages that are not managed by asdf
### Actual Behaviour
asdf shims packages that it should not shim
### Environment
```shell
OS:
Darwin my-mac.local 23.5.0 Darwin Kernel Version 23.5.0: ...
x86_64
SHELL:
zsh 5.9 (x86_64-apple-darwin23.0)
ASDF:
version: v0.14.0-3a3a3a3
ASDF environment variables:
ASDF_DIR=/usr/local/opt/asdf
ASDF_DATA_DIR=/Users/you/.asdf
ASDF_CONFIG_FILE=/Users/you/.asdfrc
ASDF_DEFAULT_TOOL_VERSIONS_FILENAME=/Users/you/.tool-versions
ASDF_USER_SHIMS_DIR=/Users/you/.asdf/shims
ASDF_USER_BIN=/Users/you/.asdf/bin
```
### asdf plugins affected (if relevant)
_No response_
Contributor guide
Research direction
Start by reproducing the asdf-python workflow with a .tool-versions file, an activated virtual environment, and the `which myexecutable` checks shown here. Inspect how asdf shims and the user shims directory handle commands outside the managed versions; done means unmanaged virtual-environment executables are not intercepted after deactivation, while managed tools still work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, python, shell
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100