generated from bazel-contrib/rules-template
-
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove BASH_BIN in favor of referencing bash via /usr/bin/env
While using rules_py in combination with rules_oci, I discovered an unexpected behaviour: rules_py generates #! shebang lines using the path to bin that the sh toolchain uses. This has the unexpected side effect of baking in the bash path from the machine that built the container, which may or may not be the same bash path that the container itself will have. I discovered that macOS, Ubuntu, and the default @python docker image all have bash at `/bin/bash`, but surprisingly, GitHub Actions workers have it at `/usr/bin/bash`. We can side step this problem entirely by using `#!/usr/bin/env bash` as our shebang line, which I believe to be sufficiently portable and robust to use for rules_py's scripts. See [this Stack Overflow](https://stackoverflow.com/questions/21612980/why-is-usr-bin-env-bash-superior-to-bin-bash) question for further discussion on the approach.
- Loading branch information
Mark Christian
committed
Dec 7, 2023
1 parent
e5c2112
commit 4e0755e
Showing
4 changed files
with
2 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!{{BASH_BIN}} | ||
#!/usr/bin/env bash | ||
|
||
{{BASH_RLOCATION_FN}} | ||
|
||
|
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!{{BASH_BIN}} | ||
#!/usr/bin/env bash | ||
|
||
USE_MANIFEST_PATH={{USE_MANIFEST_PATH}} | ||
|
||
|