jdx / mise

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

Not a valid shim unless MISE_DATA_DIR matches shim creation #2327

Open eugenesvk opened 1 week ago

eugenesvk commented 1 week ago

Describe the bug After moving my data with MISE_DATA_DIR I've started to have issues launching shims unless this var is also set (which wasn't the case for some commands launched as new processes like shells themselves)

To Reproduce Set MISE_DATA_DIR to some path Install Python with mise and a python packages (xonsh in this example) mise reshim to add the installe binary to your /mise/shims folder Unset MISE_DATA_DIR (or set to something else) Launch this newly installed shim

Get an error

Error:
   0: xonsh is not a valid shim

Location:
   src/shims.rs:246

Version:
   2024.6.6 macos-x64 (2024-06-20)

  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
                                ⋮ 4 frames hidden ⋮
   5: mise::shims::err_no_version_set::hb9c6b13218124ade
      at <unknown source file>:<unknown line>
   6: mise::shims::handle_shim::h55cf5e32029103bd
      at <unknown source file>:<unknown line>
   7: mise::cli::Cli::run::h7f341fc775d2ec5d
      at <unknown source file>:<unknown line>
   8: mise::main::hc0ee40ac5b9e5a20
      at <unknown source file>:<unknown line>
   9: std::sys_common::backtrace::__rust_begin_short_backtrace::hb96152835a281cde
      at <unknown source file>:<unknown line>
  10: std::rt::lang_start::{{closure}}::h683105829722e6ac
      at <unknown source file>:<unknown line>
  11: std::panicking::try::h6c2c804670fe7870
      at <unknown source file>:<unknown line>
  12: std::rt::lang_start_internal::hd99fa46c7e6b97c1
      at <unknown source file>:<unknown line>
  13: _main<unknown>
      at <unknown source file>:<unknown line>

Expected behavior (At the very least a more understandable error message) The shim should still work? I might be missing something about the shim arcitechture, but I thought they shouldn't care what the environment is that points to a place where they already are?

Mise doctor ```text ~ > mise doctor  20.15.0 version: 2024.6.6 macos-x64 (2024-06-20) activated: yes shims_on_path: no build_info: Target: x86_64-apple-darwin Features: DEFAULT, NATIVE_TLS Built: Thu, 20 Jun 2024 17:14:41 +0000 Rust Version: rustc 1.79.0 (129f3b996 2024-06-10) (Homebrew) Profile: release shell: /usr/local/bin/fish fish, version 3.7.1 dirs: data: ~/App/mise config: ~/.config/mise cache: ~/Library/Caches/mise state: ~/AppData/state/mise shims: ~/App/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) java (core) node (core) python (core) ruby (core) zig (core) toolset: python@3.12.4 node@20.15.0 env_vars: MISE_SHELL=fish MISE_DATA_DIR=/App/mise 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 = [] node_compile = false not_found_auto_install = true paranoid = false plugin_autoupdate_last_check_duration = "7d" python_default_packages_file = "/Users/eugenesv/.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 ```