asdf-vm/asdf

bug: asdf version 12.x and 13.x clobbers the PATH

botp opened this issue · 2 comments

botp commented

Describe the Bug

i am currently stuck at version 11.1 because versions 12.1 and 13.1 clobbers PATH.

see:

$ ruby -v
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-linux]

$ which ruby
/home/botp/.asdf/installs/ruby/3.2.2/bin/ruby

... but my .tool-versions tell otherwise

$ cat .tool-versions
ruby 2.7.8
nodejs 19.9.0

... the PATH has changed. "/home/botp/.asdf/installs/ruby/3.2.2/bin" should not have been prepended. note, that if i remove it, tool-versions will work (obviously).

$ echo $PATH
/home/botp/.asdf/installs/ruby/3.2.2/bin:/home/botp/.asdf/shims:/home/botp/.asdf/bin:/home/botp/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

Steps to Reproduce

i have multiple versions of ruby.
sh invokes ruby which invokes wmii (a window manager) and creates different windows for different working directory. some of these directories have different versions of ruby but they are controlled (supposedly) by .tool-versions.
when transfering/cd-ing to a directory, the behaviour shows as describe in bug section.

Expected Behaviour

PATH must not be changed.

Actual Behaviour

PATH has changed.

Environment

$ asdf info
OS:
Linux pc-ni-botp 5.4.0-150-generic #167~18.04.1-Ubuntu SMP Wed May 24 00:51:42 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

SHELL:
GNU bash, version 4.4.20(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

BASH VERSION:
4.4.20(1)-release

ASDF VERSION:
v0.13.1-0586b37

ASDF INTERNAL VARIABLES:
ASDF_DEFAULT_TOOL_VERSIONS_FILENAME=.tool-versions
ASDF_DATA_DIR=/home/botp/.asdf
ASDF_DIR=/home/botp/.asdf
ASDF_CONFIG_FILE=/home/botp/.asdfrc

ASDF INSTALLED PLUGINS:
elixir                       https://github.com/asdf-vm/asdf-elixir.git master a4c42e1
erlang                       https://github.com/asdf-vm/asdf-erlang.git master 6744df7
nodejs                       https://github.com/asdf-vm/asdf-nodejs.git master 9275f49
python                       https://github.com/danhper/asdf-python.git master 5e277e2
ruby                         https://github.com/asdf-vm/asdf-ruby.git master 4e5b177

asdf plugins affected (if relevant)

No response

Version v0.12 introduced an environment variable, ASDF_FORCE_PREPEND to control this behavior. It's enabled by default on macOS to work around issues with path_helper.

Does setting it to no resolve this issue?

Related to #1579.

botp commented