-
Notifications
You must be signed in to change notification settings - Fork 873
fix: restore symlink support for tool versions #1937
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
fix: restore symlink support for tool versions #1937
Conversation
originPath := InstallPath(conf, plugin, toolversions.Version{Type: "version", Value: versionStr}) | ||
aliasPath := InstallPath(conf, plugin, toolversions.Version{Type: "version", Value: aliasStr}) | ||
err := os.Symlink(originPath, aliasPath) | ||
assert.Nil(t, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These last two lines can be combined into one.
internal/installs/installs_test.go
Outdated
t.Run("returns installed versions including symlinks", func(t *testing.T) { | ||
conf, plugin := generateConfig(t) | ||
mockInstall(t, conf, plugin, "1.0.0") | ||
aliasVersion(t, conf, plugin, "1.0.0", "latest") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do not support aliases in asdf core. Please rename this function to something that indicates it only generates a symlink, and please remove the latest
version as latest
is never permitted in .tool-versions
files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR @khmm12! I'm in favor of restoring symlink support for .tool-versions
files if it is indeed missing, but it does not appear that these changes actually do that. These changes are affecting how asdf determines if a version is installed, which is completely unrelated to the process that locates and reads .tool-versions
files. I think it'd be best to close this PR as I don't think any of these changes can be accepted.
Greetings @Stratus3D 👋
Exactly. The previous Bash-based versions correctly detected installed tool versions that were symlinks. However, the current implementation no longer recognizes them, which is a clear regression. It seems there might be some misunderstanding—this is not about .tool-versions files themselves, but about tool versions and their symlinks. The issue is that symlinked versions, which were previously supported, are no longer detected. I agree that aliasing should be handled by reworking how asdf selects tool versions from .tool-versions files. However, this PR specifically addresses the regression where symlinked versions, which users actively rely on, stopped working. Example use case of symlinks:
.tool-versions
This setup worked in previous versions but is no longer working. Since users depend on this behavior, it seems reasonable to restore it. Could you clarify do you see an alternative way to address the issue? |
Fixes a regression where symlink support for tool versions was inadvertently dropped. Fixes asdf-vm#1873
9bb6ad8
to
28e6b1c
Compare
My plugin (asdf-go-sdk) has also stopped working due to this issue. However, I have confirmed that this pull request resolves the problem. From what I can see, symbolic link detection is handled carefully, and the errors module is used for error handling, making it a well-implemented fix that properly restores the previous behavior. I hope this gets merged and released soon so that my plugin can function again. |
Hi @khmm12. The asdf data directory ( I'm sorry @yacchi you'll need to alter your plugin so that it doesn't need to write symlinks. |
Thank you for your response. I understand the importance of asdf's data directory structure and the need to limit where plugins read and write files. However, the Changing this directory would break compatibility with these tools, making the development experience more cumbersome. Symbolic links were a solution to bridge this compatibility gap while integrating with asdf. Given the current restrictions, do you have any suggestions or guidance on how to maintain compatibility with IDEs while adhering to asdf's data directory policy? We would greatly appreciate any ideas or best practices for addressing this challenge. Thank you for your support and consideration. |
@Stratus3D I'd like to echo the concerns of @khmm12 and @yacchi about the current situation. There has been a lot of feedback over the years in #523 that alias versions as a concept is useful. I understand why you don't want it to become a core feature of asdf itself, but I'd like you to consider the practical reality of how asdf is used by many of its current users (plus the people who switched to Mise because of missing features like this one). The Thank you for considering our use case, and I really hope we can find a way forward that fits everyone. |
Summary
Fixes a regression where symlink support for tool versions was inadvertently dropped. Versions prior to 0.16.0 supported symlinks for tool versions, which are used, for example, by alias plugin.