Repository navigation
Conversation
mise x falls back to PATH when a tool has no matching binary, so the stub in ~/.local/bin re-executes itself until the machine stalls. Use mise which and exec the real path instead (omacom#13177). Co-authored-by: AnPod <[email protected]>
mise x falls back to PATH when the tool has no matching binary, which re-executes the ~/.local/bin stub until the machine stalls. Add a per-command re-entry guard and regenerate unguarded quiet wrappers. Co-authored-by: AnPod <[email protected]>
7b02c43 to
af64637
Compare
chessing234
left a comment
There was a problem hiding this comment.
please keep package and command arguments inert in the generated wrapper.
| # which finds this stub again. Fail fast rather than recursing until the machine | ||
| # runs out of processes. | ||
| if [ -n "\$$guard" ]; then | ||
| printf '%s: mise could not provide "%s" from tool "%s" (is it installed?)\\n' "$command" "$bin" "$package" >&2 |
There was a problem hiding this comment.
please shell-quote the values interpolated into this diagnostic as well: $command, $bin and $package are written raw into the generated shell source, undoing the escaping above. a package argument containing a literal $(...) remains inert on the base revision but executes that substitution on the new re-entry error path; reuse the escaped arguments when generating the printf call.
|
|
Thanks for this. One behavior problem with the guard that I don't think has been raised yet: The guard is inherited by the real tool. The stub runs A fix that doesn't leak state is to resolve the binary from the tool itself and exec it by absolute path, which is what the PR description says it does, though the diff still uses bin_path=$(mise which --tool <package> <bin>) || {
printf '%s: mise could not provide "%s" from tool "%s"\n' <command> <bin> <package> >&2
exit 127
}
exec "$bin_path" "$@"That also covers greptile's point about PATH picking up an unrelated executable. Also, #13470 is your earlier PR for the same issue, so one of the two should be closed. |
|
I reviewed this at 4d972c8 against At this head the exported guard @jandrusk described is gone. The wrapper now resolves the binary from the tool and executes it by absolute path, so nested calls through the same wrapper work, and a missing binary exits 127 instead of falling back to
#8692 is the oldest of these fixes. It resolves the binary from the package's The second opinion, Codex Medium, compared the five diffs separately and also recommends #8692. It found the Which of these lands is the maintainer's call. This one is waiting on that decision. |
Summary
Fixes #13177
mise x … -- binfalls back toPATHwhen the tool has no matching binary, which re-executes the~/.local/binstub until the machine stalls.Change
mise which(absolute path) instead of PATH fallbackTest plan
bash test/shell.d/mise-install-test.shbash test/shell.d/mise-stub-recursion-migration-test.sh