jdx / mise

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

Can't revert `mise trust` #1500

Open HaleTom opened 5 months ago

HaleTom commented 5 months ago

Describe the bug

% mise trust
mise trusted /home/var/ravi/stow/tmp/node-env-test/.mise.toml
% mise trust --untrust
mise No trusted config files found.
mise Run with --verbose or MISE_VERBOSE=1 for more information

To Reproduce

% mise trust
mise trusted /home/var/ravi/stow/tmp/node-env-test/.mise.toml
% mise trust --untrust --verbose
[DEBUG] ARGS: mise trust --untrust --verbose
Error:
   0: No trusted config files found.

Location:
   src/cli/trust.rs:52

Version:
   2024.1.24 linux-x64 (e5a9d6b 2024-01-22)

Suggestion: Run with --verbose or MISE_VERBOSE=1 for more information.

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
% cat .mise.toml
[env]
NODE_ENV = "development"
foo = "bar"
% pwd
/home/ravi/tmp/node-env-test

Expected behavior

I expect to be able to do mise trust followed by mise trust --untrust which would reverse the first command.

mise doctor output

% mise doctor
 mise ~/.config/mise/config.toml is not trusted. Trust it? Yes
 mise /home/var/ravi/stow/tmp/node-env-test/.mise.toml is not trusted. Trust it? Yes
 mise /home/var/ravi/stow/tmp/node-env-test/.mise.toml is not trusted. Trust it? Yes
mise version:
  2024.1.24 linux-x64 (e5a9d6b 2024-01-22)

build:
  Target: x86_64-unknown-linux-gnu
  Features: DEFAULT, NATIVE_TLS
  Built: Mon, 22 Jan 2024 06:20:10 +0000
  Rust Version: rustc 1.75.0 (82e1608df 2023-12-21)
  Profile: release

shell:
  /bin/zsh
  zsh 5.9 (x86_64-pc-linux-gnu)

mise data directory:
  /home/ravi/.local/share/mise

mise environment variables:
  (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,
    "jobs": 4,
    "legacy_version_file": true,
    "legacy_version_file_disable_tools": [],
    "node_compile": false,
    "not_found_auto_install": true,
    "paranoid": true,
    "plugin_autoupdate_last_check_duration": "7d",
    "python_compile": false,
    "python_default_packages_file": "/home/ravi/.default-python-packages",
    "python_patch_url": null,
    "python_precompiled_os": null,
    "python_patches_directory": null,
    "python_precompiled_arch": null,
    "python_pyenv_repo": "https://github.com/pyenv/pyenv.git",
    "python_venv_auto_create": false,
    "raw": false,
    "shorthands_file": null,
    "task_output": null,
    "trusted_config_paths": [],
    "quiet": false,
    "verbose": false,
    "yes": false,
    "ci": false,
    "cd": null,
    "debug": false,
    "env_file": null,
    "trace": false,
    "log_level": "info"
  }

config files:
  ~/.config/mise/config.toml
  /home/var/ravi/stow/tmp/node-env-test/.mise.toml

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

toolset:

No problems found

Additional context Note the weird doubling above:

mise /home/var/ravi/stow/tmp/node-env-test/.mise.toml is not trusted. Trust it? Yes
mise /home/var/ravi/stow/tmp/node-env-test/.mise.toml is not trusted. Trust it? Yes

mise doctor keeps on asking me to trust the local and global .toml files, each and every time, even if I always say 'Yes'.

HaleTom commented 5 months ago

This may be related to #1501.

I noted this:

ravi@svelte:~/.local/state/mise% tree -a
.
├── tracked-configs
│   ├── 2a1a40a1fbd377d4 -> /home/ravi/.dotfiles/misc/.config/mise/config.toml
│   ├── 7d332f57fb657a9e -> /home/ravi/.config/mise/config.toml
└── trusted-configs
    ├── mise-config.hash
    ├── mise-config.toml-2a1a40a1fbd377d4 -> /home/ravi/.dotfiles/misc/.config/mise/config.toml
    ├── mise-config.toml-7d332f57fb657a9e -> /home/ravi/.config/mise/config.toml

Both of the 2 distinct files listed here are the same config file, where /home/ravi/.config/mise/config.toml is a symlink to the other.

HaleTom commented 5 months ago

But no, trusting both doesn't help:

% mise trust --verbose ~/.config/mise/config.toml
[DEBUG] ARGS: mise trust --verbose /home/ravi/.config/mise/config.toml
[INFO] mise trusted /home/ravi/.dotfiles/misc/.config/mise/config.toml
[DEBUG] ARGS: mise hook-env -s zsh
Error:
   0: error parsing config file: ~/.config/mise/config.toml
   1: Config file is not trusted.
      Trust it with `mise trust`.

Location:
   src/config/config_file/mod.rs:214

Version:
   2024.1.24 linux-x64 (e5a9d6b 2024-01-22)

Suggestion: Run with --verbose or MISE_VERBOSE=1 for more information.

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
%
%
%
% mise trust --verbose "$(realpath ~/.config/mise/config.toml)"
[DEBUG] ARGS: mise trust --verbose /home/ravi/.dotfiles/misc/.config/mise/config.toml
[INFO] mise trusted /home/ravi/.dotfiles/misc/.config/mise/config.toml
[DEBUG] ARGS: mise hook-env -s zsh
Error:
   0: error parsing config file: ~/.config/mise/config.toml
   1: Config file is not trusted.
      Trust it with `mise trust`.

Location:
   src/config/config_file/mod.rs:214

Version:
   2024.1.24 linux-x64 (e5a9d6b 2024-01-22)

Suggestion: Run with --verbose or MISE_VERBOSE=1 for more information.

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

Cancel the possible relation to #1501 --

In the example above, /home/var/ravi/stow/tmp/node-env-test/.mise.toml was not a symlink.