Skip to content

fix!: Be aware of ForcePrepend#2028

Closed
machupicchubeta wants to merge 1 commit intoasdf-vm:masterfrom
machupicchubeta:be_aware_of_force_prepend
Closed

fix!: Be aware of ForcePrepend#2028
machupicchubeta wants to merge 1 commit intoasdf-vm:masterfrom
machupicchubeta:be_aware_of_force_prepend

Conversation

@machupicchubeta
Copy link
Copy Markdown
Contributor

@machupicchubeta machupicchubeta commented Mar 20, 2025

Summary

Previously, the value of ForcePrepend was not used anywhere and was not behaving as specified.
With this commit, the behavior will be as specified.

BREAKING CHANGE

So far, ASDF_FORCE_PREPEND environment variable setting has been ignored, but this commit may change the behavior depending on the setting.

If it is not set, macOS behavior will not change, but Linux behavior will change.
If you want to get the same behavior as before, it is recommended to set the relevant environment variable.

Other Information

Referenced Documents

Background

@andrecloutier told about this issue me in a comment on another PullRequest. Thank you!

@machupicchubeta machupicchubeta requested a review from a team as a code owner March 20, 2025 14:43
@machupicchubeta machupicchubeta marked this pull request as draft March 20, 2025 15:01
@machupicchubeta machupicchubeta force-pushed the be_aware_of_force_prepend branch 2 times, most recently from 32bab49 to 137b35f Compare March 20, 2025 17:16
Previously, the value of `ForcePrepend` was not used anywhere and was not behaving as specified.
With this commit, the behavior will be as specified.

BREAKING CHANGE:
So far, `ASDF_FORCE_PREPEND` environment variable setting has been ignored, but this commit may change the behavior depending on the setting.

If it is not set, macOS behavior will not change, but Linux behavior will change.
If you want to get the same behavior as before, it is recommended to set the relevant environment variable.

Referenced Documents:
- https://github.com/asdf-vm/asdf/blob/932ac468b7c24c2adef90a293a1f7280a0074cc4/docs/manage/configuration.md#asdf_force_prepend

Background:
@andrecloutier told about this issue me in a comment on another PullRequest. Thank you!
- asdf-vm#2011 (comment)
@machupicchubeta machupicchubeta force-pushed the be_aware_of_force_prepend branch from 5e0609e to f9bf8fb Compare March 20, 2025 18:28
@machupicchubeta machupicchubeta marked this pull request as ready for review March 20, 2025 18:39
@machupicchubeta machupicchubeta changed the title fix: Be aware of ForcePrepend fix!: Be aware of ForcePrepend Mar 20, 2025
@Stratus3D
Copy link
Copy Markdown
Member

Hi @machupicchubeta , thanks for this PR and your previous one. I should have given more thought before merging #2011 and #2026. The force prepend option was only ever used one place - https://github.com/asdf-vm/asdf/blob/master/asdf.sh#L63. This file was a Bash script used in version 0.15.0 and older. It was sourced by the shell to expose an asdf function that wrapped the actual executable and allowed certain commands to alter the user's environment. We've migrated fully to Go, and have decided to eliminate the use of all shell code in asdf itself. All that remains is a couple lines of shell-specific config code that users need to add to their shell's RC file.

The force prepend option was never actually used in the internal code for asdf, even in the older versions. It was only ever used for altering the PATH variable in the user's current shell session. Given this information, this PR isn't actually restoring old behavior, it's actually altering behavior that's existed for many version. I don't think there is actually a problem here anymore that can be solved with an option like this. If my understanding of this is flawed or incomplete please let me know, but I think it would be best if I remove all the force prepend option from the Go code completely. It was initially just a workaround for MacOS I believe.

@Stratus3D
Copy link
Copy Markdown
Member

Closing for now in favor of #2089

@Stratus3D Stratus3D closed this May 15, 2025
@machupicchubeta
Copy link
Copy Markdown
Contributor Author

@Stratus3D
Thank you for the detailed explanation and for taking the time to reflect on this!
Your reasoning makes perfect sense, and I agree with your assessment. I appreciate the context around the legacy shell code and the move to Go — that definitely clarifies things.
I’m happy to see asdf evolving, and I look forward to contributing again in the future.
Thanks again for your thoughtful response!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants