Avoid depending on coreutils in bazel shell actions (NixOS compatibility) - #29510
Open
nicdumz wants to merge 3 commits into
Open
Avoid depending on coreutils in bazel shell actions (NixOS compatibility)#29510nicdumz wants to merge 3 commits into
nicdumz wants to merge 3 commits into
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
…ell action ProtocAuthenticityCheck's run_shell action runs unqualified with no declared env/PATH, so it inherits an empty action environment. On systems without an FHS-style /bin:/usr/bin (e.g. NixOS), bash's compiled-in fallback PATH doesn't resolve 'grep' or 'cat', and the action fails with 'command not found' even though bash itself was found via an explicit toolchain path. Replace grep/cat with a single 'read' plus bash's [[ ]] pattern matching and 'echo', so the version check only depends on bash builtins.
…strap protoc invocation
_extra_proto_path builds a -I flag via $$(dirname $(location ...)),
run inside a genrule shell action with no declared env/PATH. On systems
without an FHS-style /bin:/usr/bin (e.g. NixOS), this fails with
'dirname: command not found'.
Replace it with bash parameter expansion (${var%/*}) over a variable
assigned earlier in the same command, so the path directory-name
computation depends only on bash builtins.
nicdumz
force-pushed
the
avoid-coreutils-deps-bootstrap
branch
from
August 29, 2026 13:41
9adc122 to
ec2c07b
Compare
nicdumz
marked this pull request as ready for review
August 29, 2026 13:57
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.
run_shell/genrule actions with no declared env/PATH inherit an empty action environment. On systems without an FHS-style/bin:/usr/bin(e.g. NixOS), bash's compiled-in fallback PATH doesn't resolve coreutils binaries likegrep,cat, ordirname, even though bash itself is found via an explicit toolchain path.ProtocAuthenticityCheck's shell action usedgrep/catfor a version check; replaced with a singlereadplus bash[[ ]]pattern matching andecho, so it depends only on bash builtins.bootstrap_compiler.bzl's_extra_proto_pathbuilt a-Iflag via$$(dirname $(location ...)); replaced with bash parameter expansion (${var%/*}) over a variable assigned earlier in the same command, again depending only on bash builtins.