-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
PSA: bash != sh ! #408
Comments
Hello, @Kreyren Very good explanation - https://stackoverflow.com/questions/27813563/what-is-the-bash-file-extension man bash Google Shell Style Guide - https://google.github.io/styleguide/shell.xml Bash is the only shell scripting language permitted for executables. Executables should have no extension (strongly preferred) or a .sh extension. Libraries must have a .sh extension and should not be executable. However, for libraries it's important to know what language it is and sometimes there's a need to have similar libraries in different languages. This allows library files with identical purposes but different languages to be identically named except for the language-specific suffix. |
Based on my experience i believe this being false since bash recognizes
Correct, but that does not make it POSIX compatible on system that doesn't have shebang module compiled in nor system that does not support dynamic linking.. Also POSIX shell is generally faster then bash.
for executable permission it depends on the script usecase |
cc @alepauly any thoughts? |
I'm not sure that I understand the question fully. Are you saying that the first line should be |
@ethomson if a minor optimization is worth the effort then |
What I don't understand is: what's the problem here that you're trying to solve with this? We want to use bash because we want to be able to use bash-isms. Despite specifying |
I believe this being code quality issue that may cause the mentioned issues in the future where I am considering refactoring the project since there are more issues assuming that GitHub Actions are used on my projects to know how upstream handles the code-quality to know if it's worth the time and welcomed. |
Yes, you're very much right that code quality is very important. I agree with you 100%. We take code quality seriously, and would welcome pull requests that address code quality issues. But "quality" is often subjective. Using Do recall that these scripts exist only to create the environments that our runners support, and that they need only to be executed in our sandboxed environment, only to create that environment, and are then deleted. They will never operate in any environment where This is independent from using GitHub Actions, even on the environments where these scripts were created. So this particular issue is stylistic and - while I understand that style is subjective - this is the one that we've chosen and want to remain consistent with. If you have other code quality issues - eg, sloppy quoting, using things like |
Submitted, context and method of testing required for proper implementation
Then it is a terrible standard, notice the changes in #438 where we can do all the functions using POSIX shell, also standard without any linting you can't be serious to say that it is a best practice (ConaLisas added in #438).
It is a concern of sanitization and optimization not only stylistic. |
I'm sorry that you don't like it but again, bash will always be installed on our environments, so there's no reason not to use bashisms for convenience. |
Why is this being used instead of proper shebang based on provided extension?
The text was updated successfully, but these errors were encountered: