Fix asdf version detection for v0.17.0+ (fixes #59) #60
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix asdf version detection for v0.17.0+ (fixes #59)
Problem
The
get_asdf_version()
function instarkup.sh
uses a regex pattern with a$
anchor that expects the version number to be at the end of the line:However, asdf v0.17.0 changed its output format to include additional information:
The extra text
(revision fc87e22)
after the version number causes the regex to fail because of the$
end-of-line anchor, resulting in an empty string instead of extracting0.17.0
.Root Cause Analysis
$
anchor expects version to be at end of line, but asdf v0.17.0+ includes revision infoget_asdf_version()
returns empty string instead of0.17.0
is_asdf_legacy()
callsversion_less_than("", "0.16.0")
0.16.0
, so function returnstrue
asdf global
instead of modernasdf set --home
asdf global
doesn't exist in v0.17.0, causing installation failureSolution
Simple fix: Remove the
$
anchor from the regex pattern to allow matching versions with additional text after them.Before
After
Testing
Verified the fix works correctly with various asdf version output formats:
asdf version v0.17.0 (revision fc87e22)
0.17.0
0.17.0
v0.16.7
0.16.7
0.16.7
0.15.9
0.15.9
0.15.9
asdf v0.17.1-beta
0.17.1-beta
0.17.1-beta
version 0.14.0
0.14.0
0.14.0
Legacy Detection Test
Confirmed
is_asdf_legacy()
now works correctly:asdf version v0.17.0 (revision fc87e22)
v0.16.0
0.15.9
0.14.0
Impact
asdf set --home
for modern,asdf global
for legacyFiles Changed
starkup.sh
: Line 434 - Updated regex inget_asdf_version()
functionRelated Issues
Closes #59
Verification Steps
To verify this fix works:
asdf set --home
instead ofasdf global