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

mise trust doesn't handle relative paths #1807

Closed
yous opened this issue Mar 21, 2024 · 0 comments · Fixed by #2037
Closed

mise trust doesn't handle relative paths #1807

yous opened this issue Mar 21, 2024 · 0 comments · Fixed by #2037
Labels
bug Something isn't working

Comments

@yous
Copy link

yous commented Mar 21, 2024

Describe the bug

When mise trust is executed with a relative path of config file, trusted-configs points to a wrong path.

To Reproduce

mkdir ~/foo
cd ~/foo
echo << EOF > .mise.toml
[env]
_.python.venv = "venv"
EOF
mise trust ./.mise.toml

But the output of mise trust is confusing:

$ mise trust .mise.toml
mise trusted /Users/yous/foo/.mise.toml
mise Config file is not trusted.
Trust it with `mise trust`.
mise Run with --verbose or MISE_VERBOSE=1 for more information
$ mise trust ./.mise.toml
mise trusted /Users/yous/foo/.mise.toml
mise Config file is not trusted.
Trust it with `mise trust`.
mise Run with --verbose or MISE_VERBOSE=1 for more information

The input goes to trusted-configs directly, so relative paths are not working:

$ ls -alF ~/.local/state/mise/trusted-configs
total 8
drwxr-xr-x@ 5 yous  staff  160 Mar 21 16:47 ./
drwxr-xr-x@ 4 yous  staff  128 Mar 21 16:22 ../
-rw-r--r--@ 1 yous  staff   64 Mar 21 16:45 .mise.hash
lrwxr-xr-x@ 1 yous  staff   10 Mar 21 16:47 .mise.toml-24d2afe543c3f0fa@ -> .mise.toml
lrwxr-xr-x@ 1 yous  staff   12 Mar 21 16:45 .mise.toml-ff3e8c3a48cfb2b6@ -> ./.mise.toml

A clear and concise description of what the bug is.

Expected behavior

Links in trusted-configs should point to the absolute paths like /Users/yous/foo/.mise.toml.

mise doctor output

version: 2024.3.7 macos-arm64 (2024-03-21)
activated: yes
shims_on_path: no

build_info:
  Target: aarch64-apple-darwin
  Features: DEFAULT, NATIVE_TLS
  Built: Thu, 21 Mar 2024 01:25:04 +0000
  Rust Version: rustc 1.76.0 (07dca489a 2024-02-04) (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
  ~/foo/.mise.toml

plugins:
  bun     (core)
  deno    (core)
  go      (core)
  java    (core)
  node    (core)
  python  (core)
  ruby    (core)

toolset:
  [email protected]
  [email protected]
  [email protected]

env_vars:
  MISE_SHELL=zsh

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_compile = false
  python_default_packages_file = "/Users/yous/.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 problems found
@yous yous added the bug Something isn't working label Mar 21, 2024
@jdx jdx closed this as completed in #2037 May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant