-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Use /usr/bin/env bash
in shebang for all scripts under tests
#10277
Conversation
This makes scripts executable on system without /bin/bash (NixOS)
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.
Thanks for the improvement! Left one comment and when addressed I think this is good to merge
tests/lint/check_asf_header.sh
Outdated
@@ -1,4 +1,4 @@ | |||
#!/bin/bash -e | |||
#!/usr/bin/env -S bash -e |
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.
While you're cleaning these up could you move all the bash -e
usages into a set -e
after the apache header everywhere? That way we can have a consistent bash invocation across all scripts
#!/usr/bin/env -S bash -e | |
#!/usr/bin/env bash |
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.
Updated. Actually it won't build without this change. The coreutil in the CI docker image might be old and doesn't have the -S
arg for env
.
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.
Some scripts already have set -euxo pipefail
so I didn't add set -e
to them
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.
Thanks @yelite for the fix!
…e#10277) * Use /usr/bin/env bash in shebang This makes scripts executable on system without /bin/bash (NixOS) * Use `set -e` in script instead of `bash -e` in shebang
This makes scripts executable on system without /bin/bash (NixOS).
Although this is not perfectly portable (some system may have /bin/env rather than usr/bin/env), it's better than just using /bin/bash (https://en.wikipedia.org/wiki/Shebang_(Unix)#Program_location).