Skip to content

fix(doctor): improve shell path resolution#742

Open
kalvinnchau wants to merge 2 commits into
mainfrom
kalvin/doctor
Open

fix(doctor): improve shell path resolution#742
kalvinnchau wants to merge 2 commits into
mainfrom
kalvin/doctor

Conversation

@kalvinnchau
Copy link
Copy Markdown
Contributor

Summary

  • fix doctor binary resolution to avoid treating zsh function/alias output as executable paths.
  • replace login-shell which with path-only shell lookup: whence -p for zsh and type -P for bash.
  • validate resolved candidates as absolute executable files before using them.
  • apply the same resolver hardening to shared acp-client and blox-cli command discovery.
  • simplify resolver control flow and add focused tests for invalid shell output.

i have git mapped to a function that does some cleanup, but a minimal repro:

git() {
  echo "hi"
  command git "$@"
}
image

Testing

  • cargo fmt -p doctor -p acp-client -p blox-cli
  • cargo test -p doctor -p acp-client -p blox-cli

use shell path-only lookup commands instead of plain which and validate resolved candidates as absolute executable files.

apply the same executable validation to shared cli resolvers so function or alias output cannot be treated as a binary path.
flatten login shell resolution branches and avoid an intermediate allocation when building lookup commands.

preserve executable path validation while making output summarization safe for non-ascii command output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant