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 works incorrectly with symlinked configuration file #2175

Closed
toupeira opened this issue May 23, 2024 · 1 comment · Fixed by #2186
Closed

mise trust works incorrectly with symlinked configuration file #2175

toupeira opened this issue May 23, 2024 · 1 comment · Fixed by #2186
Labels
bug Something isn't working

Comments

@toupeira
Copy link

Describe the bug

My configuration file is symlinked from ~/.config/mise/config.toml to /etc/dotfiles/config/mise/config.toml, this worked fine in Mise prior to version 2024.5.11 but now results in an error Config file is not trusted.

The symlink in ~/.local/state/mise/trusted-configs looks correct:

$ ls -l ~/.local/state/mise/trusted-configs/
total 4
-rw-rw-r-- 1 toupeira toupeira 64 Mai 23 11:35 mise-config.hash
lrwxrwxrwx 1 toupeira toupeira 37 Mai 23 11:35 mise-config.toml-7519310cd5e2132a -> /etc/dotfiles/config/mise/config.toml

But mise trust seems to use the realpath when creating the symlink, and the original path when checking:

$ mise -v trust
[DEBUG] ARGS: mise -v trust
[INFO] mise trusted /etc/dotfiles/config/mise/config.toml
mise Config file is not trusted.
Trust it with `mise trust`.
mise Run with --verbose or MISE_VERBOSE=1 for more information

Running other commands shows this prompt, asking if the original path should be trusted:

$ mise exec -- fzf
 mise ~/.config/mise/config.toml is not trusted. Trust it?


   Yes     No  

←/→ toggle • y/n/enter submit

This creates a second symlink and fixes the Config file is not trusted. error:

$ ls -l ~/.local/state/mise/trusted-configs/
total 4
-rw-rw-r-- 1 toupeira toupeira 64 Mai 23 11:37 mise-config.hash
lrwxrwxrwx 1 toupeira toupeira 39 Mai 23 11:37 mise-config.toml-2ce2d28d2e83642d -> /home/toupeira/.config/mise/config.toml
lrwxrwxrwx 1 toupeira toupeira 37 Mai 23 11:35 mise-config.toml-7519310cd5e2132a -> /etc/dotfiles/config/mise/config.toml

To Reproduce

Use a symlink for ~/.config/mise/config.toml

Expected behavior

This should work without errors.

mise doctor output

version: 2024.5.21 linux-x64 (ef24c46 2024-05-23)
activated: yes
shims_on_path: no

build_info: 
  Target: x86_64-unknown-linux-gnu
  Features: DEFAULT, NATIVE_TLS, OPENSSL
  Built: Thu, 23 May 2024 01:53:55 +0000
  Rust Version: rustc 1.78.0 (9b00956e5 2024-04-29)
  Profile: release

shell: 
  /bin/bash
  GNU bash, version 5.2.21(1)-release (x86_64-pc-linux-gnu)
  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: ~/.cache/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)
  erlang   (core)
  fzf      https://github.com/kompiro/asdf-fzf.git#d19eb67
  go       (core)
  helm     https://github.com/Antiarchitect/asdf-helm.git#f4b7f38
  java     (core)
  jq       https://github.com/mise-plugins/asdf-jq.git#6d86d19
  kubectl  https://github.com/asdf-community/asdf-kubectl.git#cbe6df4
  neovim   https://github.com/richin13/asdf-neovim.git#d6118ad
  node     (core)
  python   (core)
  rclone   https://github.com/johnlayton/asdf-rclone.git#6d0fb47
  ruby     (core)
  usage    https://github.com/jdx/mise-usage.git#fe3888a
  yarn     https://github.com/twuni/asdf-yarn.git#376c540

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

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 = 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 = false
  paranoid = false
  plugin_autoupdate_last_check_duration = "7d"
  python_default_packages_file = "/home/toupeira/.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
Add any other context about the problem here.

@toupeira
Copy link
Author

Thanks for the quick fix @roele! 🙇

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