jdx / mise

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

mise ls-remote zig shows `master` as a valid option but it does not work #2403

Closed chasinglogic closed 2 months ago

chasinglogic commented 2 months ago

Describe the bug

I would like to run zig master as that is recommended by https://ziglang.org

It seems that mise supports this with mise ls-remote zig showing a master version but when I attempt to install it I get an HTTP error as the download URL seems incorrect.

To Reproduce

!! ~ λ mise install zig@master
Error:
   0: HTTP status client error (403 Forbidden) for url (https://ziglang.org/download/master/zig-macos-aarch64-master.tar.xz)

Location:
   src/http.rs:61

Version:
   2024.7.4 macos-arm64 (b9bc7df 2024-07-19)

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.

Expected behavior

I expected mise to install the zig nightly build.

mise doctor output

version: 2024.7.4 macos-arm64 (b9bc7df 2024-07-19)
activated: yes
shims_on_path: no

build_info: 
  Target: aarch64-apple-darwin
  Features: DEFAULT, NATIVE_TLS, OPENSSL
  Built: Fri, 19 Jul 2024 02:45:51 +0000
  Rust Version: rustc 1.79.0 (129f3b996 2024-06-10)
  Profile: release

shell: 
  /opt/homebrew/bin/bash
  GNU bash, version 5.2.26(1)-release (aarch64-apple-darwin23.2.0)
  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.

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

config_files: 
  ~/.tool-versions
  ~/.config/mise/config.toml

backends: 
  cargo
  core
  go
  npm
  pipx
  spm
  ubi

plugins: 
  bun            (core)
  deno           (core)
  erlang         (core)
  go             (core)
  golangci-lint  https://github.com/hypnoglow/asdf-golangci-lint.git#fee877b
  goreleaser     https://github.com/kforsthoevel/asdf-goreleaser.git#821ed34
  helm           https://github.com/Antiarchitect/asdf-helm.git#f4b7f38
  java           (core)
  node           (core)
  python         (core)
  ruby           (core)
  zig            (core)

toolset: 
  node@20.12.2          
  python@3.12.3         
  go@1.22.5             
  zig@master            (missing)
  npm:prettier@3.2.5    
  npm:tree-sitter-cli@0.22.5  
  npm:@dotenvx/dotenvx@1.6.4  
  npm:cdktf-cli@0.20.7  
  ruby@3.2.2            

env_vars: 
  MISE_SHELL=bash

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 = true
  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
  http_timeout = 30
  jobs = 4
  legacy_version_file = true
  legacy_version_file_disable_tools = []
  libgit2 = true
  node_compile = false
  not_found_auto_install = true
  paranoid = false
  plugin_autoupdate_last_check_duration = "7d"
  python_default_packages_file = "/Users/mathewrobinson/.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

No warnings found
No problems found

Additional context

I think zig have changed the format of their URLs. But if I read this PR correctly then mise should pull it down from the /downloads/index.json which has the correct URL.

Add any other context about the problem here. Consider running mise with --debug or --trace for extra debug info.

~ λ mise install --debug zig@master
[DEBUG] ARGS: /Users/mathewrobinson/.local/bin/mise install --debug zig@master
[DEBUG] Config {
    Config Files: [
        "~/.config/mise/config.toml",
        "~/.tool-versions",
    ],
}
[DEBUG] ToolRequestSet.build(38.458µs): ToolRequestSet: ruby@3.2.2 python@3.12 node@lts go@latest zig@master npm:prettier@latest npm:tree-sitter-cli@latest npm:@dotenvx/dotenvx@latest npm:cdktf-cli@latest

[DEBUG] install_versions: zig@master
downloading zig-macos-aarch64-master.tar.xz
[DEBUG] GET Downloading https://ziglang.org/download/master/zig-macos-aarch64-master.tar.xz to ~/.local/share/mise/downloads/zig/master/zig-macos-aarch64-master.tar.xz
[DEBUG] GET https://ziglang.org/download/master/zig-macos-aarch64-master.tar.xz
[DEBUG] starting new connection: https://ziglang.org/
[DEBUG] GET https://ziglang.org/download/master/zig-macos-aarch64-master.tar.xz 403 Forbidden
Error:
   0: HTTP status client error (403 Forbidden) for url (https://ziglang.org/download/master/zig-macos-aarch64-master.tar.xz)

Location:
   src/http.rs:61

Version:
   2024.7.4 macos-arm64 (b9bc7df 2024-07-19)

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
chasinglogic commented 2 months ago

Ah my confusion is answered after actually reading the code I found I need to use ref:master instead of master.

I think it is a bug that ls-remote returns master when that's not a valid value. Would you like a PR to remove it?

roele commented 2 months ago

@chasinglogic I agree that this might mislead people to think that master is a installable version. IMO it should not be shown with ls-remote. A pull request would be highly appreciated.