jdx / mise

dev tools, env vars, task runner
https://mise.jdx.dev
MIT License
8.28k stars 219 forks source link

Versions that contain hyphens are not parsed correctly #2180

Closed sneako closed 1 month ago

sneako commented 1 month ago

Describe the bug It appears that the mise install command is unable to parse versions that contain hyphens. For example, Elixir versions can specify the major Erlang version they were compiled with, ie 1.16.3-otp-26. Putting quotes around the version does not seem to help.

As a work around, manually editing ~/.config/mise/config.toml with these versions that contain hyphens followed by mise isntall does the trick.

To Reproduce mise ls-remote elixir lists these exact versions, however:

❯ mise install elixir 1.17.0-rc.0-otp-27
mise No repository found for plugin 1.17.0-rc.0-otp-27
mise Run with --verbose or MISE_VERBOSE=1 for more information
❯ mise install elixir '1.17.0-rc.0-otp-27'
mise No repository found for plugin 1.17.0-rc.0-otp-27
mise Run with --verbose or MISE_VERBOSE=1 for more information
❯ mise install elixir "1.17.0-rc.0-otp-27"
mise No repository found for plugin 1.17.0-rc.0-otp-27
mise Run with --verbose or MISE_VERBOSE=1 for more information

It also occurs for non-release candidate versions:

❯ mise install elixir 1.16.3-otp-26
mise No repository found for plugin 1.16.3-otp-26
mise Run with --verbose or MISE_VERBOSE=1 for more information

It appears to work only when the version contains no hyphens:

❯ mise install elixir 1.16.3
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 7090k  100 7090k    0     0  3122k      0  0:00:02  0:00:02 --:--:-- 3123k
mise elixir@1.16.3 ✓ installed  

Expected behavior Users should be able to install Elixir versions that contain hyphens with the mise install command.

mise doctor output

❯ mise doctor
version: 2024.5.21 macos-arm64 (2024-05-23)
activated: no
shims_on_path: yes

build_info:
  Target: aarch64-apple-darwin
  Features: DEFAULT, NATIVE_TLS
  Built: Thu, 23 May 2024 03:16:32 +0000
  Rust Version: rustc 1.78.0 (9b00956e5 2024-04-29) (Homebrew)
  Profile: release

shell:
  /bin/zsh
  zsh 5.9 (x86_64-apple-darwin23.0)

dirs:
  data: ~/.local/share/mise
  config: ~/.config/mise
  cache: ~/Library/Caches/mise
  state: ~/.local/state/mise
  shims: ~/.local/share/mise/shims

config_files:
  ~/.config/mise/config.toml

backends:
  cargo
  core
  go
  npm
  pipx
  ubi

plugins:
  bun        (core)
  deno       (core)
  elixir     https://github.com/mise-plugins/mise-elixir.git#7b06439
  erlang     https://github.com/asdf-vm/asdf-erlang.git#8c5dacf
  go         (core)
  java       (core)
  neovim     https://github.com/richin13/asdf-neovim.git#cefa92a
  node       (core)
  postgres   https://github.com/smashedtoatoms/asdf-postgres.git#e970a77
  protoc     https://github.com/paxosglobal/asdf-protoc.git#a44c5cd
  python     (core)
  ruby       (core)
  rust       https://github.com/code-lever/asdf-rust.git#95acf4f
  terraform  https://github.com/asdf-community/asdf-hashicorp.git#f1602b6
  yarn       https://github.com/mise-plugins/asdf-yarn.git#74ea3b9

toolset:
  elixir@1.16.2-otp-26
  erlang@27.0
  neovim@0.9.5
  node@20.13.0
  postgres@15.6
  go@1.22.3
  ruby@3.3.1
  terraform@1.8.3
  java@20.0.2

env_vars:
  (none)

settings:
  activate_aggressive = false
  all_compile = false
  always_keep_download = false
  always_keep_install = false
  asdf_compat = false
  cargo_binstall = true
  color = true
  disable_default_shorthands = false
  disable_tools = []
  experimental = false
  go_default_packages_file = "~/.default-go-packages"
  go_download_mirror = "https://dl.google.com/go"
  go_repo = "https://github.com/golang/go"
  go_set_gopath = false
  go_set_goroot = true
  go_skip_checksum = false
  jobs = 4
  legacy_version_file = true
  legacy_version_file_disable_tools = []
  node_compile = false
  not_found_auto_install = true
  paranoid = false
  plugin_autoupdate_last_check_duration = "7d"
  python_default_packages_file = "/Users/nico/.default-python-packages"
  python_pyenv_repo = "https://github.com/pyenv/pyenv.git"
  raw = false
  trusted_config_paths = []
  quiet = false
  verbose = false
  yes = false
  ci = false
  debug = false
  trace = false
  log_level = "info"
  python_venv_auto_create = false

  [status]
  missing_tools = "if_other_versions_installed"
  show_env = false
  show_tools = false

1 warning found:

1. plugin erlang overrides a core plugin

No problems found
roele commented 1 month ago

To install a tool version, mise uses the format <tool>@<version> not the asdf space separated format <tool> <version>. Therefore the command should be mise install elixir@1.17.0-rc.0-otp-27.

sneako commented 1 month ago

Ah! I guess it's just a coincidence that it works sometimes without the @. Thanks!

roele commented 1 month ago

I would assume that simply the latest version as per mise latest elixir is installed without the @ which is default behaviour when omitting the version.

sneako commented 1 month ago

Here's an example what I get locally when I use a space instead of @:

❯ mise install elixir 1.15.6
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 6680k  100 6680k    0     0  4500k      0  0:00:01  0:00:01 --:--:-- 4501k
mise elixir@1.15.6 ✓ installed

Anyways, thanks and apologies for not readings the docs properly 😬