mise
mise copied to clipboard
`mise run`, `mise exec`: uses previous value of removed env var on first run after var removal
Describe the bug This is clearly a shell "activate" mode issue. Maybe it's even not a bug, but an UX issue. Maybe it's good enough to just document it instead of fixing.
If mise config is edited not in the current shell (e.g. in IDE) and some env.var is removed (using any way: commented, set to false
, deleted), and first executed command after this edit is mise run
or mise exec
, then they'll use previous (deleted) value for this variable. This happens because current shell had no chance to execute mise hook-env
after edit thus current shell still have this var set to old value and mise run/exec
gets it in same way as any manually set in a shell variable.
To Reproduce Use two shells:
sh1$ mkdir mise-del-var-bug
sh1$ cd mise-del-var-bug
sh1$ env | grep VAR
sh1$ mise set VAR=val
sh1$ mise exec -- env | grep VAR; echo; cat .mise.toml
VAR=val
[env]
VAR = "val"
sh1$
sh2$ cd mise-del-var-bug
sh2$ sed -i -e 's/"val"/"modified"/' .mise.toml
sh2$
sh1$ mise exec -- env | grep VAR; echo; cat .mise.toml
VAR=modified
[env]
VAR = "modified"
sh1$
sh2$ sed -i -e 's/"modified"/false/' .mise.toml
sh2$ # NEXT COMMAND WILL USE REMOVED VALUE:
sh1$ mise exec -- env | grep VAR; echo; cat .mise.toml
VAR=modified
[env]
VAR = false
sh1$ mise exec -- env | grep VAR; echo; cat .mise.toml
[env]
VAR = false
sh1$
Expected behavior
Well, in an ideal world, I'd like to avoid mise exec/run
execution with variables which doesn't match current config. After all, doc states "Of course, tasks launched with mise will include the mise environment—your tools and env vars defined in mise.toml." and this is violated here.
mise doctor
output
version: 2024.11.0 linux-x64 (eae29db 2024-11-01)
activated: yes
shims_on_path: no
build_info:
Target: x86_64-unknown-linux-gnu
Features: DEFAULT, NATIVE_TLS, OPENSSL
Built: Fri, 1 Nov 2024 11:36:23 +0000
Rust Version: rustc 1.81.0 (eeb90cda1 2024-09-04)
Profile: release
shell:
/bin/zsh
zsh 5.9 (x86_64-pc-linux-gnu)
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
~/tmp/mise-del-var-bug/.mise.toml
backends:
cargo
core
go
npm
pipx
spm
ubi
vfox
plugins:
jq ssh://[email protected]/mise-plugins/asdf-jq.git#6d86d19
yamlfmt ssh://[email protected]/mise-plugins/asdf-yamlfmt.git#c5760c1
toolset:
ubi:jdx/[email protected]
ubi:watchexec/[email protected]
ubi:aquaproj/[email protected]
ubi:go-task/[email protected]
go:github.com/oklog/ulid/v2/cmd/[email protected]
ubi:santhosh-tekuri/[email protected]
ubi:bronze1man/[email protected]
ubi:mikefarah/[email protected]
ubi:fullstorydev/[email protected]
ubi:fullstorydev/[email protected]
ubi:ktr0731/[email protected]
pipx:a13xp0p0v/kernel-hardening-checker@latest
go:golang.org/x/review/[email protected]
ubi:ankitpokhrel/[email protected]
ubi:noahgorstein/[email protected]
ubi:cespare/[email protected]
ubi:jondot/[email protected]
ubi:kubernetes-sigs/[email protected]
ubi:kubernetes/[email protected]
go:github.com/bernardo-bruning/[email protected]
ubi:plandex-ai/plandex@cli/v1.1.1
npm:[email protected]
ubi:magefile/[email protected]
go:github.com/erning/gorun@latest
go:golang.org/x/pkgsite/cmd/pkgsite@latest
go:golang.org/x/tools/cmd/[email protected]
go:golang.org/x/tools/cmd/[email protected]
go:github.com/rogpeppe/[email protected]
ubi:oligot/[email protected]
ubi:psampaz/[email protected]
ubi:uber-go/[email protected]
go:golang.org/x/tools/cmd/[email protected]
go:rsc.io/rf@latest
go:github.com/quasilyte/gogrep/cmd/[email protected]
go:golang.org/x/tools/cmd/[email protected]
go:github.com/josharian/[email protected]
go:github.com/koron/iferr@latest
go:github.com/fatih/[email protected]
go:github.com/davidrjenni/reftools/cmd/fillswitch@latest
go:github.com/davidrjenni/reftools/cmd/fillstruct@latest
go:github.com/maruel/panicparse/v2/cmd/[email protected]
go:github.com/smartystreets/[email protected]
go:golang.org/x/perf/cmd/benchstat@latest
env_vars:
MISE_LOG_FILE=~/.local/share/mise.log
MISE_LOG_FILE_LEVEL=info
MISE_SHELL=zsh
settings:
activate_aggressive = false
all_compile = false
always_keep_download = false
always_keep_install = false
asdf_compat = false
cache_prune_age = "30d"
ci = false
color = true
debug = false
disable_backends = []
disable_default_registry = false
disable_hints = []
disable_tools = []
experimental = true
fetch_remote_versions_cache = "1h"
fetch_remote_versions_timeout = "10s"
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 = "30s"
jobs = 4
legacy_version_file = true
legacy_version_file_disable_tools = []
libgit2 = true
lockfile = false
log_level = "info"
not_found_auto_install = true
paranoid = true
pin = false
plugin_autoupdate_last_check_duration = "7d"
quiet = false
raw = false
trace = false
trusted_config_paths = [
"~/.config/mise/config.toml",
"~/.mise.toml",
"~/proj/soft/golangci-lint-strict/",
"~/tmp/mise-del-var-bug/",
]
use_versions_host = true
verbose = false
yes = false
[cargo]
binstall = true
[node]
[pipx]
uvx = true
[python]
default_packages_file = "~/.default-python-packages"
pyenv_repo = "https://github.com/pyenv/pyenv.git"
venv_auto_create = false
venv_stdlib = false
[ruby]
default_packages_file = "~/.default-gems"
ruby_build_repo = "https://github.com/rbenv/ruby-build.git"
ruby_install = false
ruby_install_repo = "https://github.com/postmodern/ruby-install.git"
[status]
missing_tools = "if_other_versions_installed"
show_env = false
show_tools = false
No warnings found
No problems found