Skip to content
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

Merged
merged 2 commits into from
Feb 17, 2022

Conversation

yelite
Copy link
Contributor

@yelite yelite commented Feb 16, 2022

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).

This makes scripts executable on system without /bin/bash (NixOS)
Copy link
Member

@driazati driazati left a 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

@@ -1,4 +1,4 @@
#!/bin/bash -e
#!/usr/bin/env -S bash -e
Copy link
Member

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

Suggested change
#!/usr/bin/env -S bash -e
#!/usr/bin/env bash

Copy link
Contributor Author

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.

Copy link
Contributor Author

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

Copy link
Member

@junrushao junrushao left a 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!

@masahi masahi merged commit c54a3dd into apache:main Feb 17, 2022
@yelite yelite deleted the fix-script-shebang branch February 17, 2022 15:44
pfk-beta pushed a commit to pfk-beta/tvm that referenced this pull request Apr 11, 2022
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants