-
-
Notifications
You must be signed in to change notification settings - Fork 31.1k
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
gh-129156: Fix variable quoting in android-env.sh
script
#129321
Conversation
Tested with |
if [ $(uname) = "Darwin" ]; then | ||
export CPU_COUNT=$(sysctl -n hw.ncpu) | ||
if [ "$(uname)" = "Darwin" ]; then | ||
CPU_COUNT="$(sysctl -n hw.ncpu)" | ||
export CPU_COUNT | ||
else | ||
export CPU_COUNT=$(nproc) | ||
CPU_COUNT="$(nproc)" | ||
export CPU_COUNT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The export
is separated from the assignment as a failed command would be ignored otherwise (see https://www.shellcheck.net/wiki/SC2155)
49c57f7
to
1978ae5
Compare
It'd still be nice to test against the shell in the report, but I couldn't reproduce the failure they described with several shells. |
!buildbot android |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Thanks for the fixes!
@freakboy3742: If you're happy, please merge and backport.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly a little overzealous on some of the quoting (API level can't have spaces pretty much by definition), but it doesn't hurt to be consistent. Thanks for the PR!
Thanks @zanieb for the PR, and @freakboy3742 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13. |
Sorry, @zanieb and @freakboy3742, I could not cleanly backport this to
|
…pt (pythonGH-129321) Adds quoting to `android-env.sh` to protect against spaces in paths. (cherry picked from commit a49225c) Co-authored-by: Zanie Blue <[email protected]>
GH-129332 is a backport of this pull request to the 3.13 branch. |
…-129321) (#129332) Adds quoting to `android-env.sh` to protect against spaces in paths. (cherry picked from commit a49225c) Co-authored-by: Zanie Blue <[email protected]>
As reported in #129156, the lack of quoting can cause problems.
I added quoting to variables throughout the script. I used
shellcheck
to confirm that there were not remaining cases.