Open primeapple opened 2 years ago
Can you clarify something, I am confused. Do you want the asdf shim, the asdf install or the regular non-asdf installed tmux? Are you saying you don't want /home/me/.asdf/installs/tmux/3.2a/bin
to appear in your PATH
? I am not sure how it is being added. Have you raised this with the tmux plugin author?
I want the asdf shim in my path within tmux. I never want /home/me/.asdf/installs/tmux/3.2a/bin
in my path. I don't even have regular non-asdf tmux installed (but if I had I guess it is always in the path because of /usr/bin/
, but with less precedence than the asdf tmux) ;-)
The problem is not because of any plugin (it happens without any plugins installed), it just leads to issues in combination with the plugin. That's how I found it.
Thanks for answering. I know it sounds complicated, because there are so many tmux
words in it :D
Update:
There was a very helpful answer by user @systemmonkey42 in https://github.com/tmux/tmux/issues/2992#issuecomment-988344774
What he found was that, whenever we run an application, it's actual binary is added to the path, BEFORE the shim executables of this application.
To quote him:
vim
asdf plugin add vim asdf install vim $ which vim /home/admin/.asdf/shims/vim $ vim +'!which vim' /home/admin/.asdf/installs/vim/8.2.3757/bin/vim
nodejs
asdf plugin add nodejs asdf plugin install nodejs $ which node /home/admin/.asdf/shims/node $ node -e "childprocess.exec('which node',(,o)=>console.log(o))" /home/admin/.asdf/installs/nodejs/17.2.0/bin/node
tmux
asdf plugin add tmux asdf plugin install tmux $ which tmux /home/admin/.asdf/shims/tmux $ tmux new-session -d $ tmux run-shell 'which tmux' /home/admin/.asdf/installs/tmux/3.2a/bin/tmux
Is this an actual design by asdf? Is this a bug? What would be a workaround for it (since I don't want it, at least in the tmux case).
If I might weigh in here, there is a "bug", but I think it might be intentional.
When I use 'asdf' to launch vim
, it will prepend the path to the specified vim version to $PATH
, then launch vim. Similar to
PATH=<path to asdf managed vim>:$PATH vim "$@"
The problem we are talking about is when using asdf
to launch tmux
, each tmux
pane launches a new shell, which sources .asdf/asdf.sh
on startup.
As a side effect of this, ~/.asdf/bin
and ~/.asdf/shim
are re-inserted at the beginning of $PATH
in each pane within tmux.
If I later run a tmux
command, such as tmux split-window
, the SHIM is found in the path, and risks running the wrong tmux binary depending on any local configuration. (Which may break the client/server protocols used)
I would suggest the path to any application like tmux
should remain before ~/.asdf/shims
.
As a workaround, I don't source ~/.asdf/asdf.sh
in any shell within tmux. This isn't perfect but mostly works.
Does this make sense? Thx
Describe the Bug
When using the asdf tmux install and start in TMUX the actual tmux binary is added to the path. This means, that running
which tmux
does not give me the tmux shim, but instead the actual currently installed binary path.This creates problems when, for example, using
which tmux
in scripts, where it needs to point to the shim, tmux continuum for exampleI tested this on my desktop (Manjaro KDE, fish shell, extensive
.tmux.conf
), as well as in a Virtual Machine (Manjaro Cinnamon, Bash Shell, no.tmux.conf
).I already asked the tmux/tmux guys, but they told me it's not a tmux issue: https://github.com/tmux/tmux/issues/2992
Steps to Reproduce
Expected Behaviour
There are 2 solutions to this:
Actual Behaviour
Already described above, please if you want more knowledge, look at https://github.com/tmux/tmux/issues/2992#issuecomment-986018921
Environment
asdf plugins affected (if relevant)
aphecetche/asdf-tmux