fix: use "command -v" to find interpreter in $PATH#3150
Merged
aignas merged 1 commit intobazel-contrib:mainfrom Aug 7, 2025
malt3:env_toolchain_command_lookup
Merged
fix: use "command -v" to find interpreter in $PATH#3150aignas merged 1 commit intobazel-contrib:mainfrom malt3:env_toolchain_command_lookup
aignas merged 1 commit intobazel-contrib:mainfrom
malt3:env_toolchain_command_lookup
Conversation
aignas
reviewed
Aug 6, 2025
Collaborator
aignas
left a comment
There was a problem hiding this comment.
Thank you for the PR, LGTM, could you please add a note about this in the CHANGELOG.md please
In some environments, `which` doesn't work correctly under Bazel, while `command -v` does. I think the difference is that `command` is a shell builtin (and POSIX compliant), whereas `which` is not: ``` $ sh -c 'builtin command -v python3' /usr/bin/python3 $ sh -c 'builtin which python3' sh: line 1: builtin: which: not a shell builtin ``` While `command -v` performs fewer checks under the hood, it is more portable.
aignas
approved these changes
Aug 7, 2025
malt3
added a commit
to bazel-contrib/rules_img
that referenced
this pull request
Aug 7, 2025
It interferes with the BCR publishing and a fix has been merged upstream: bazel-contrib/rules_python#3150
malt3
added a commit
to bazel-contrib/rules_img
that referenced
this pull request
Sep 9, 2025
Version 1.6.x and later contains this fix: bazel-contrib/rules_python#3150
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
In some environments,
whichdoesn't work correctly under Bazel, whilecommand -vdoes.I think the difference is that
commandis a shell builtin (and POSIX compliant), whereaswhichis not:While
command -vperforms fewer checks under the hood, it is more portable.