Skip to content

bug: ASDF "latest:[...]" not working as it should #2073

@Venefic

Description

@Venefic

Describe the Bug

Since ASDF version 0.16.5 every install command that is installing 'latest' version in certain conditions is not working. I've pinpointed the exact commit and thing that is doing so. Pull request fix: latest version returns latest version #1996 containing commit 46d3f42 does add an additional filtering by "numericStartFilterRegex"that is created in line 27 and used in line 264. This causes every software distribution not starting with a number to fail during 'latest' installation eg. java latest:temurin-8 or python latest:pypy3.9 but when you try 'python latest:3.13' it will work.
Below will be tests and results so a lot of pasting:
Testing installation when using version 0.16.7 with added prints before filters, after numeric filter and after latest filter:
root@665ce900120d:/new/asdf/cmd/asdf# asdf install java latest:temurin-8 All versions: [temurin-8.0.302+8 temurin-8.0.312+7 temurin-8.0.322+6 temurin-8.0.332+9 temurin-8.0.342+7 temurin-8.0.345+1 temurin-8.0.352+8 temurin-8.0.362+9 temurin-8.0.372+7 temurin-8.0.382+5 temurin-8.0.392+8 temurin-8.0.402+6 temurin-8.0.412+8 temurin-8.0.422+5 temurin-8.0.432+6 temurin-8.0.442+6 temurin-8.0.452+9] Filter after numeric: [] Filter after latest: [] error installing version: no latest version found

And then after changing line 262 in versions.go file to:
versions = filterOutByRegex(allVersions, latestFilterRegex, false)
I've got:
root@665ce900120d:/new/asdf/cmd/asdf# asdf install java latest:temurin-8 All versions: [temurin-8.0.302+8 temurin-8.0.312+7 temurin-8.0.322+6 temurin-8.0.332+9 temurin-8.0.342+7 temurin-8.0.345+1 temurin-8.0.352+8 temurin-8.0.362+9 temurin-8.0.372+7 temurin-8.0.382+5 temurin-8.0.392+8 temurin-8.0.402+6 temurin-8.0.412+8 temurin-8.0.422+5 temurin-8.0.432+6 temurin-8.0.442+6 temurin-8.0.452+9] Filter after numeric: [] Filter after latest: [temurin-8.0.302+8 temurin-8.0.312+7 temurin-8.0.322+6 temurin-8.0.332+9 temurin-8.0.342+7 temurin-8.0.345+1 temurin-8.0.352+8 temurin-8.0.362+9 temurin-8.0.372+7 temurin-8.0.382+5 temurin-8.0.392+8 temurin-8.0.402+6 temurin-8.0.412+8 temurin-8.0.422+5 temurin-8.0.432+6 temurin-8.0.442+6 temurin-8.0.452+9]
And it started to install correct version (temurin-8.0.452+9)

I would propose to remove the filtering that removes everything not starting with a number as this should be filtered on the side of plugin, and since this was merged not sure how many different plugins are affected.

Steps to Reproduce

  1. Install ASDF version 0.16.5 or higher
  2. Add plugin java or python
  3. Try installing any version that does not start with a number eg. latest:temurin-8

Expected Behaviour

ASDF grabs latest temurin-8 version (temurin-8.0.452+9), downloads and installs it.

Actual Behaviour

You will get an error like:
root@17b4adcee23c:~# asdf install java latest:temurin-8 error installing version: no latest version found

Environment

OS:
Linux 17b4adcee23c 6.10.14-linuxkit #1 SMP Thu Mar 20 16:32:56 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux

SHELL:
GNU bash, version 5.2.21(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2022 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:
5.2.21(1)-release

ASDF VERSION:
v0.16.5

ASDF INTERNAL VARIABLES:
ASDF_DEFAULT_TOOL_VERSIONS_FILENAME=.tool-versions
ASDF_DATA_DIR=/root/.asdf
ASDF_CONFIG_FILE=/root/.asdfrc

ASDF INSTALLED PLUGINS:
dotnet     https://github.com/hensou/asdf-dotnet                04bab449f3a29e4faaa7a2dd4be08eab59abc68b
helm       https://github.com/Antiarchitect/asdf-helm.git       085651c91e61936289ed79976fe3ba53bf6787ae
java       https://github.com/halcyon/asdf-java.git             cecb96773181cd0990deee3ab258260aa1189135
kubectl    https://github.com/asdf-community/asdf-kubectl.git   2fb3b57090e3efe55953a751a134c271ba83b119
maven      https://github.com/halcyon/asdf-maven.git            583612baaa031ca1ef4cf73185c51bb0fcc52daf
opentofu   https://github.com/virtualroot/asdf-opentofu.git     abe1013677c56742c74adcac79f0734e6c232e09
python     https://github.com/danhper/asdf-python.git           a3a01856098d6d2b9642e382f5b38e70275726d1
shellcheck https://github.com/luizm/asdf-shellcheck.git         66200ffa221fc75d7b28103f53326db6e721d08f
terraform  https://github.com/asdf-community/asdf-hashicorp.git 22eb1c4a16adcde39aaaf89fbb5d9404a1601fce
terragrunt https://github.com/gruntwork-io/asdf-terragrunt.git  c3c4f74458defc52d5944b68179205f6b8ca9bb8

asdf plugins affected (if relevant)

python, java

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions