Repository navigation
fix(tool-stub): keep env_with_path instead of rebuilding PATH #12322
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| #!/usr/bin/env bash | ||
| # shellcheck disable=SC2103 | ||
| # | ||
| # tool-stub non-cached exec must: | ||
| # 1. Keep project _.path dirs so sibling stubs remain LookPath-able | ||
| # 2. Prefer the stub-selected tool version over an outer task's tool bins | ||
|
|
||
| export MISE_GPG_VERIFY=false | ||
|
|
||
| mkdir -p tool_stub_preserves_caller_path/bin | ||
| cd tool_stub_preserves_caller_path | ||
|
|
||
| # --- _.path sibling stubs remain visible ------------------------------------ | ||
|
|
||
| cat >mise.toml <<'EOF' | ||
| [env] | ||
| _.path = ["./bin"] | ||
|
|
||
| [tasks.check] | ||
| run = "dummy" | ||
| EOF | ||
|
|
||
| cat >bin/dummy <<'EOF' | ||
| #!/usr/bin/env -S mise tool-stub | ||
| tool = "dummy" | ||
| version = "1.0.0" | ||
| EOF | ||
| chmod +x bin/dummy | ||
|
|
||
| cat >bin/sibling <<'EOF' | ||
| #!/usr/bin/env bash | ||
| echo sibling-found | ||
| EOF | ||
| chmod +x bin/sibling | ||
|
|
||
| # Install via stub (also writes tool-stub bin-path cache) | ||
| assert_contains "mise run check" "This is Dummy" | ||
|
|
||
| # Replace the installed binary with a PATH probe. Keep the tool installed so the | ||
| # next stub run skips install but still hits execute_with_tool_request after the | ||
| # bin-path cache is cleared (not the inherit-PATH short-circuit). | ||
| DUMMY_BIN="$MISE_DATA_DIR/installs/dummy/1.0.0/bin/dummy" | ||
| cat >"$DUMMY_BIN" <<'EOF' | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
| command -v sibling | ||
| EOF | ||
| chmod +x "$DUMMY_BIN" | ||
|
|
||
| rm -rf "$MISE_CACHE_DIR/tool-stubs" | ||
|
|
||
| assert_contains "mise run check" "sibling" | ||
|
|
||
| # --- stub-selected version wins over outer toolset -------------------------- | ||
|
|
||
| mkdir -p ../tool_stub_no_shadow/bin | ||
| cd ../tool_stub_no_shadow | ||
|
|
||
| cat >mise.toml <<'EOF' | ||
| [tools] | ||
| dummy = "1.0.0" | ||
|
|
||
| [env] | ||
| _.path = ["./bin"] | ||
|
|
||
| [tasks.check] | ||
| run = "dummy" | ||
| EOF | ||
|
|
||
| cat >bin/dummy <<'EOF' | ||
| #!/usr/bin/env -S mise tool-stub | ||
| tool = "dummy" | ||
| version = "2.0.0" | ||
| EOF | ||
| chmod +x bin/dummy | ||
|
|
||
| mise install dummy@1.0.0 dummy@2.0.0 | ||
| rm -rf "$MISE_CACHE_DIR/tool-stubs" | ||
|
|
||
| # Outer task activates dummy@1.0.0; stub selects 2.0.0 — must not resolve 1.0.0 | ||
| assert_contains "mise run check" "This is Dummy 2.0.0" | ||
| assert_not_contains "mise run check" "This is Dummy 1.0.0" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.