Skip to content
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: asdf latest --all report wrong runtimes #1180

Open
scalp42 opened this issue Mar 8, 2022 · 2 comments
Open

bug: asdf latest --all report wrong runtimes #1180

scalp42 opened this issue Mar 8, 2022 · 2 comments
Labels

Comments

@scalp42
Copy link

scalp42 commented Mar 8, 2022

Describe the Bug

Hi folks,

I've noticed a bug where asdf latest --all report the wrong runtimes version (added in #1096 and fixed in #1118).

Here's example:

$> asdf latest --all
packer	1.8.0	installed
python	stackless-3.7.5	missing
ruby	truffleruby+graalvm-21.3.0	missing
terraform	1.1.7	installed

If I try to run asdf latest individually, the right runtime is picked:

$> asdf latest python
3.10.2

$> asdf latest ruby
3.0.2

asdf version: v0.9.0-7493f40

Thanks in advance for looking into it and thank you for asdf.

Steps to Reproduce

  1. Install asdf
  2. Add python and ruby plugins: asdf plugin add python & asdf plugin add ruby
  3. Run asdf latest --all

Expected Behaviour

It should have listed Python 3.10.2 and Ruby 3.0.2.

Actual Behaviour

It listed:

# python
stackless-3.7.5

# ruby
truffleruby+graalvm-21.3.0

Environment

OS:
Darwin 42MBPM1X.local 21.3.0 Darwin Kernel Version 21.3.0: Wed Jan  5 21:37:58 PST 2022; root:xnu-8019.80.24~20/RELEASE_ARM64_T6000 arm64

SHELL:
zsh 5.8 (x86_64-apple-darwin21.0)

ASDF VERSION:
v0.9.0-7493f40

ASDF ENVIRONMENT VARIABLES:
ASDF_DIR=/Users/scalp/.zinit/plugins/asdf-vm---asdf

ASDF INSTALLED PLUGINS:
bundler                      https://github.com/jonathanmorley/asdf-bundler.git master a461ac4
caddy                        https://github.com/salasrod/asdf-caddy.git master b864330
consul                       https://github.com/Banno/asdf-hashicorp.git master c53d4fd
crystal                      https://github.com/asdf-community/asdf-crystal.git master 0642d44
golang                       https://github.com/kennyp/asdf-golang.git master 85dab2f
nodejs                       https://github.com/asdf-vm/asdf-nodejs.git master 54113a9
nomad                        https://github.com/Banno/asdf-hashicorp.git master c53d4fd
packer                       https://github.com/Banno/asdf-hashicorp.git master c53d4fd
python                       https://github.com/danhper/asdf-python.git master 57a4d72
ruby                         https://github.com/asdf-vm/asdf-ruby.git master e06154e
terraform                    https://github.com/Banno/asdf-hashicorp.git master c53d4fd

asdf plugins affected (if relevant)

python & ruby?

@scalp42 scalp42 added the bug label Mar 8, 2022
@scalp42 scalp42 changed the title bug: asdf latest report wrong versions bug: asdf latest --all report wrong runtimes Mar 8, 2022
@roele
Copy link

roele commented Mar 30, 2022

Same for java and possibly all other plugins that have multiple distributions/variants.

The current implementation of --all expects a single (latest) version and simply shows the last entry from the asdf list all command (see command-latest.bash#L61).

mbd-s added a commit to mbd-s/dotfiles that referenced this issue May 6, 2023
mbd-s added a commit to mbd-s/dotfiles that referenced this issue May 6, 2023
Workaround for the bug described here: asdf-vm/asdf#1180
@momiji
Copy link

momiji commented Apr 25, 2024

Hello, I wonder if there was already a solution to this annoying issue and came up with some ideas.

My example:

$ asdf current java
java            openjdk-21.0.2  /home/flops/.tool-versions

$ asdf latest java
No compatible versions available (java [0-9])

$ asdf latest --all
java    zulu-musl-22.30.13      missing

One can immediately figure some issues:

  • latest java should not reply with no version, but should report the latest openjdk 21 version
  • latest --all should not reply with the latest of all java versions

Once the difference between the 2 is fixed, I have several proposal for managing variants and versions.

This does introduce no breaking change, which is I guess very very important.

1. Variants - The openjdk-21 issue

The idea is to ask java and other plugins developers to add a new variants file containing a list if regex if all their applications.
For example, for the java plugin, this file could contain a line with openjdk-21. and another with zulu-musl-22., etc. The idea is to list all "modules" provided by the plugin.

This way, asdf can identify I have installed openjdk-21 (and not 20 neither 22) and should list updates for this one only.
And of course, if I installed both zulu and openjdk, then propose both updates :)

We could then get something like this, if I installed both openjdk 21 and 22:

$ asdf latest --all
java    openjdk-21.0.3      missing
java    openjdk-22.0.1      missing

2. Versions - Sticking to 1.x

I was thinking that it could be interesting to be able to allow updating 1.x versions without updating to 2.x if I want to stay to 1.x.

There is no "good" way for doing this. I was first thinking that may adding a new file for partial versions and so on, but it looks like to be too overkill. Then I considered an easier solution, just propose all matching updates and let the user choose what he wants.

The idea is then to have something like this:

$ asdf latest xxx
xxx    2.5.1     missing (latest)
xxx    1.8.0     missing (latest 1.* based on installed 1.7.1)
xxx    1.7.5     missing (latest 1.7.* based on installed 1.7.1)

Here, as I have installed version 1.7.1, update lists the latest "1.7.", "1." and "*".

3. Pre-release - Alpha/Beta/...

There should be a way to prevent updating to a pre-release.
One idea is to mark them in the versions list provided by the plugins, maybe with a "*" or anything alike.
Maybe it is already the case?

This way, it is still possible to install a beta version, but not to update to it automatically.

Requirements

The only requirements for thes ideas to work are:

  • the version separator must be "." - this is probably already the case for every software
  • the versions provided by the plugin (I couldn't find how this is done yet) MUST be sorted by version (and not alphabetically), it seems evident but we must not forget it
  • the variants file does not need to be sorted, unless I missed something

Conclusion

These are just ideas that seem to be reasonable enough (at least to me) to add more value to asdf, especially as it does not introduce any breaking change ;)

Of course, there are probably a lot of work to do on asdf side to implement such features, and then have the plugins add the necessary files to provide the variants prefixes.

Let's continue the discussion here!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants