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

fix(qe): fix broken shebang in query-engine-wasm/build.sh #5050

Merged
merged 1 commit into from
Nov 21, 2024
Merged

Conversation

aqrln
Copy link
Member

@aqrln aqrln commented Nov 21, 2024

#!/bin/bash is non-portable and only works on some systems that have bash in that location, which is not actually standard or necessarily expected.

The only two absolute paths one can rely on in portable scripts are #!/bin/sh (which is a POSIX standard) and #!/usr/bin/env (which is not technically mandated by a formal standard but is de-facto implemented on all Unix systems).

None of my systems have a usable bash installation in /bin/bash.

My Linux system only has bash in /run/current-system/sw/bin/bash, so the script fails with ./build.sh: cannot execute: required file not found.

My macOS system has an ancient version of bash shipped with the system installed as /bin/bash (which Apple last updated in 2007 — 17 years ago — and will never ever update anymore for license reasons since bash 4+ switched to GPLv3; it's likely to be removed in future macOS versions though as macOS has long replaced bash with zsh as its shell of choice), and in some ways it's worse than not having any since modern bash scripts that assume bash 4 or 5 often fail or produce incorrect results with it. This specific script accidentally happens to work anyway, but the correct bash installation to use on this system is still /opt/homebrew/bin/bash.

Anything other than /bin/sh (be it bash or python or node) can only be dispatched via /usr/bin/env if a script is intended to be used on more than one machine because it's not possible to predict where the interpreter is going to be at.

`#!/bin/bash` is non-portable and only works on some systems which has
bash in that location, which is not actually standard or necessarily
expected.

The only two absolute paths one can rely on in portable scripts are
`#!/bin/sh` (which is a POSIX standard) and `#!/usr/bin/env` (which is
not technically mandated by a formal standard but is de-facto
implemented on all Unix systems).

None of my systems have a usable bash installation in `/bin/bash`.

My Linux system only has bash in `/run/current-system/sw/bin/bash`, so the
script fails with `sh: line 2: ./build.sh: cannot execute: required file
not found`.

My macOS system has an ancient version of bash shipped with the system
installed as `/bin/bash` (which Apple last updated in 2007 and will
never ever update anymore for license reasons since bash 4+ switched to
GPLv3; it's likely to be removed in future macOS versions though as
macOS has long replaced bash with zsh as its shell of choice), and in
some ways it's worse than not having any since modern bash scripts that
assume bash 4 or 5 often fail or produce incorrect results with it. This
specific script accidentally happens to work anyway, but the correct
bash installation to use on this system is still `/opt/homebrew/bin/bash`.

Anything other than `/bin/sh` (be it `bash` or `python` or `node`) can
only be dispatched via `/usr/bin/env` if a script is intended to be used
on more than one machine because it's not possible to predict where the
interpreter is going to be at.
@aqrln aqrln requested a review from a team as a code owner November 21, 2024 09:13
@aqrln aqrln requested review from wmadden and removed request for a team November 21, 2024 09:13
@aqrln aqrln added this to the 6.0.0 milestone Nov 21, 2024
Copy link
Contributor

WASM Query Engine file Size

Engine This PR Base branch Diff
Postgres 2.038MiB 2.038MiB 0.000B
Postgres (gzip) 818.838KiB 818.838KiB 0.000B
Mysql 2.001MiB 2.001MiB 0.000B
Mysql (gzip) 804.593KiB 804.592KiB 1.000B
Sqlite 1.900MiB 1.900MiB 0.000B
Sqlite (gzip) 765.011KiB 765.012KiB -1.000B

Copy link

codspeed-hq bot commented Nov 21, 2024

CodSpeed Performance Report

Merging #5050 will not alter performance

Comparing fix-shebang (270e457) with main (5b155e0)

Summary

✅ 11 untouched benchmarks

@aqrln aqrln merged commit 90c6eb3 into main Nov 21, 2024
342 checks passed
@aqrln aqrln deleted the fix-shebang branch November 21, 2024 10:31
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.

2 participants