-
Notifications
You must be signed in to change notification settings - Fork 788
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug: PATH order situationally broken on MacOS #1550
Comments
@merrilymeredith Thanks for the report.
This is why we haven't published a release for this yet, we were sure there would be some issues. It is marked as a "BREAKING CHANGE", so this shouldn't surprise people who read the updates before installing them. @merrilymeredith I am not sure how we should proceed here. The only way I see us being able to guard against other tooling moving PATH is by us always modifying PATH, which just adds to the problem. @hyperupcall @Stratus3D what are your thoughts on how we handle this? |
I think there are two ways to fix the issue: 1. Introduce an env vars With this option, it is clear that this behavior deviates from the default of other shells like Elvish, Fish, etc. We only need to add this to rbenv ended up doing something like this (paths were duplicated rather than being moved to the front). 2. Instruct users how to fix the broken behavior of Fundamentally, there must be no asdf entries in the A. This SO post showing to empty PATH before sourcing if [ -f /etc/profile ]; then
PATH=""
source /etc/profile
fi B. Mentioned here, another way of fixing this bug without modifying sudo chmod ugo-x /usr/libexec/path_helper C. rvm seems to fix this by appending their PATH-appending logic to I don't have a Mac, so I am unable to test these fixes, but I imagine |
From the rbenv change.
Do you mean option 2.C?
|
Yeah, I mean option 2C - it seems to be the cleanest. Since it doesn't require doing weird hacks like |
I just made a PR (#1560) that implements option 1 from this thread. It is the most straightforward way to fix things from the perspective of a user, especially if they are new to the whole shell thing. |
Option 1 does seem like the easiest solution right now. None of these seem particular elegant, but #1560 seems like the most pragmatic. |
Describe the Bug
Currently on main on MacOS, starting a login shell with an asdf environment already set up will leave asdf at the end of the path. This behavior changed with #1521. The trouble is thanks to
/etc/zprofile
andpath_helper
, which shuffles the inherited path, then asdf now avoids moving itself back to the front. zprofile doen't appear to be protected by SIP, but I imagine it gets clobbered by updates occasionally, if users were asked to change it.Steps to Reproduce
If you open a terminal, for example, then tmux or exec into tmux, it starts login shells by default, and those will have system and other paths moved ahead of asdf. This is an example just running a child shells explicitly, with child shells indented for clarity:
If you set up a terminal profile that starts tmux directly, on the other hand, asdf isn't added to the path beforehand, and the login shells started inside that session don't have this issue.
Expected Behaviour
This is an awkward situation thanks to the MacOS behavior, but I'd expect asdf to keep path priority with a normal install without requiring workarounds. I think I'm following main because I have an extreme legacy checkout, but this could cause a lot of surprises when the change hits a release.
Actual Behaviour
Detailed above.
Environment
OS: Darwin mhoward-mbp 21.6.0 Darwin Kernel Version 21.6.0: Mon Dec 19 20:46:01 PST 2022; root:xnu-8020.240.18~2/RELEASE_ARM64_T8101 arm64 SHELL: zsh 5.9 (arm-apple-darwin21.3.0) BASH VERSION: 5.2.15(1)-release ASDF VERSION: v0.11.3-684f4f0 ASDF INTERNAL VARIABLES: ASDF_DEFAULT_TOOL_VERSIONS_FILENAME=.tool-versions ASDF_DATA_DIR=/Users/meredith/.asdf ASDF_DIR=/Users/meredith/.asdf ASDF_CONFIG_FILE=/Users/meredith/.asdfrc ASDF INSTALLED PLUGINS: deno https://github.com/asdf-community/asdf-deno.git master 87442fe elixir https://github.com/asdf-vm/asdf-elixir master 1693b35 erlang https://github.com/asdf-vm/asdf-erlang master 0d402e6 nim https://github.com/rfrancis/asdf-nim.git master 4c0ce68 nodejs https://github.com/asdf-vm/asdf-nodejs master 644ada3 perl https://github.com/ouest/asdf-perl.git main f1b2040 ruby https://github.com/asdf-vm/asdf-ruby master f167b05 rust https://github.com/code-lever/asdf-rust.git master 0c88f99
asdf plugins affected (if relevant)
No response
The text was updated successfully, but these errors were encountered: