-
Notifications
You must be signed in to change notification settings - Fork 4
fix(mise): ignore mise shims when resolving tools #1209
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -289,18 +289,24 @@ wait_for_gh_rate_limit() { | |||||
| # Prints the path to a tool from either PATH or in the | ||||||
| # mise environment. | ||||||
| find_tool() { | ||||||
| local toolName="$1" | ||||||
| local toolName="$1" toolPath | ||||||
| # Deliberately not using command_exists here because we want to | ||||||
| # print the path. | ||||||
| if ! command -v "$toolName" 2>/dev/null; then | ||||||
| local misePath | ||||||
| misePath="$(find_mise)" | ||||||
| if [[ -z $misePath ]]; then | ||||||
| error "mise not found (find_tool)" | ||||||
| return 1 | ||||||
| fi | ||||||
| "$misePath" which "$toolName" 2>/dev/null | ||||||
| toolPath="$(command -v "$toolName" 2>/dev/null)" | ||||||
| # Skip mise shims: they resolve versions from the current directory's config, | ||||||
| # which doesn't declare devbase tools. Callers fall through to `mise exec`. | ||||||
| if [[ -n $toolPath ]] && [[ $toolPath != "$(mise_shim_dir)"/* ]]; then | ||||||
| echo "$toolPath" | ||||||
| return 0 | ||||||
| fi | ||||||
|
|
||||||
| local misePath | ||||||
| misePath="$(find_mise)" | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Pre-existing, but it matters a bit more now: this block used to run only when
Suggested change
|
||||||
| if [[ -z $misePath ]]; then | ||||||
| error "mise not found (find_tool)" | ||||||
| return 1 | ||||||
| fi | ||||||
| "$misePath" which "$toolName" 2>/dev/null | ||||||
| } | ||||||
|
|
||||||
| # mise_exec_tool(toolName[, args...]) | ||||||
|
|
@@ -373,6 +379,11 @@ asdf_shim_dir() { | |||||
| echo "${ASDF_DIR:-$HOME/.asdf}/shims" | ||||||
| } | ||||||
|
|
||||||
| # Where mise keeps its shims. | ||||||
| mise_shim_dir() { | ||||||
| echo "${MISE_SHIMS_DIR:-${MISE_DATA_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/mise}/shims}" | ||||||
| } | ||||||
|
|
||||||
| asdf_shim_path() { | ||||||
| local binName="$1" | ||||||
| echo "$(asdf_shim_dir)/$binName" | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line decides the scope of the fix: a shim falls through to
mise exec, anything else runs as-is. So a real binary still beats devbase's pin. A repo carryinggolangci-lint = "2.13.2"incustomMiseTools, or a Homebrew install, produces a non-shim path here and runs instead of the pinned2.9.0, with no error.Right for a repo's own tools (your
uvrow), wrong for devbase-pinned ones, andfind_toolcan't tell them apart. Not for this PR, but DT-5560's acceptance criteria ask for exactly this, so a scope note and a follow-up would help.