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(dependency_services): support bash 3.x #11434

Merged
merged 1 commit into from
Aug 29, 2023
Merged

fix(dependency_services): support bash 3.x #11434

merged 1 commit into from
Aug 29, 2023

Conversation

fffonion
Copy link
Contributor

macOS ships bash 3.x by default

Summary

Checklist

Full changelog

  • [Implement ...]

Issue reference

Fix #[issue number]

macOS ships bash 3.x by default
@flrgh
Copy link
Contributor

flrgh commented Aug 23, 2023

I understand the reasons for this change (portability, DX for Mac users, etc) and don't need to be convinced of their validity, but I don't believe they justify the maintenance burden.

Writing Bash is tedious enough as it is without having to worry about backwards compatibility with a version that is almost 20 years old. And if one build/test script must support 3.x, then they all must, or we'll go crazy chasing bugs. Scripts will be added/updated in the future, and unless we have proper linting, Bash 4.x/5.x features will slip past code review and go unnoticed for long bouts of time until we onboard a new engineer with a Mac.

The alternative solution I would propose is to keep a maintained list of dev dependencies and validate their presence in a pre-flight script/Makefile target before attempting a build.

All of that said, if it turns out that I'm the only one who feels this way, that's fine too. Please don't let this be blocked on my account.

@fffonion
Copy link
Contributor Author

@flrgh That's a valid concern. It depends on how much effort we add to developer to 1) switch bash version vs 2) maintain a 3.x compatible bash script. For example, we do disallow fish shell < 3 to be used. Since fish is a non-default shell, and whoever uses it installs on their own so they most likely know how to upgrade without further instructions.
Although macOS switch to zsh by default, it ships bash by default. If we caught into this old version, meaning the user most likely are not setting up enough dev tools, and may need further instruction other than we just mention "your bash version is too old" (things like install bash via homebrew, setup brew prefix in PATH).
An alternative will be still default to use zsh on macOS, but that's another layer of compatiblity because zsh and bash doesn't always comptaible.
Bazel's foreign rules for example still uses bash even on macOS, and invokes python scripts when the logic comes to too complex. And I guess that's still 3.x compatible because it doesn't use much syntax like assoc array. If such maintaince burden becomes an issue, switch to a non-shell language would be our choice too. But that's too early.

@fffonion fffonion merged commit 081039a into master Aug 29, 2023
25 checks passed
@fffonion fffonion deleted the bash3 branch August 29, 2023 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants