[SETUP] Use #!/usr/bin/env bash instead of #!/bin/bash in scripts#11778
Open
Zouxxyy wants to merge 2 commits intoapache:mainfrom
Open
[SETUP] Use #!/usr/bin/env bash instead of #!/bin/bash in scripts#11778Zouxxyy wants to merge 2 commits intoapache:mainfrom
#!/usr/bin/env bash instead of #!/bin/bash in scripts#11778Zouxxyy wants to merge 2 commits intoapache:mainfrom
Conversation
|
Run Gluten Clickhouse CI on x86 |
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.
What changes are proposed in this pull request?
Replace all
#!/bin/bashshebangs with#!/usr/bin/env bashin project-owned shell scripts.Third-party dependencies and documentation code blocks are left unchanged.
Some operating systems (e.g. NixOS) do not have a Bash executable at
/bin/bash, so usingenvto locate bash improves cross-platform compatibility.For example, running
dev/run-scala-test.shon macOS may fail when Bash is installed viaHomebrew at
/opt/homebrew/bin/bashrather than/bin/bash, and the hardcoded#!/bin/bashshebang picks up the outdated system Bash (3.2) instead of the user-installed version. Apple
ships Bash 3.2 and cannot upgrade it due to the GPLv3 license of Bash 4+, so macOS users who
need modern Bash features must rely on a separately installed copy, which
#!/usr/bin/env bashwill correctly resolve.
This aligns with the same change adopted by GitHub Actions runner
(see actions/runner#314) and is also consistent with what Apache Spark
does in its codebase.
Additionally, a shebang check is added to
.github/workflows/util/check.shso that future PRsintroducing
#!/bin/bashin new or modified.shfiles will be caught by the License HeaderCheck CI workflow.
How was this patch tested?
No functional change. Verified all project-owned
.shfiles now use#!/usr/bin/env bashand confirmed scripts execute correctly on macOS with Homebrew Bash. The new CI shebang check
was tested locally against both good and bad shebangs.
Was this patch authored or co-authored using generative AI tooling?
Generated-by: Kiro (Claude Opus 4.6)