-
-
Notifications
You must be signed in to change notification settings - Fork 550
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
v1.63.0 broken on Mac (bash 3.2) #337
Comments
This is quite ancient version of Bash, whereas newer and modern Bash is available on MacOS by means of MacPorts, Homebrew, or Fink.
Are you sure you had I've checked on several different servers with different OS (Ubuntu, FreeBSD, Amazon Linux) with different versions of Bash (4 and 5) and on all of them
and
|
As I know, in new versions macOS use So looks like we need to maintain compatibility with bash 3.2 🙄 |
@MaxymVlasov I even tried with https://formulae.brew.sh/formula/bash and setting my SHELL to |
Or include UPD: some hooks require external deps — why wouldn't we require modern Bash also? |
You'd need to update your |
By the way, @Chris-Softrams can you test that it works fine with bash 3.2? repos:
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: 48bc03ca3f0f2f782d2f430069868019a6892062
hooks:
- id: terraform_fmt |
That's relatively easy to fix.
Move this to the top of the file:
|
Recently ran into the same issue recently, and came across this:
I had to change my scripts to use option 2 instead of option 1 in order to be compatible on mac with enforcing a bash upgrade. Suggest to do the same here. |
This worked for me, @MaxymVlasov . I was having the same error as the issue outlines when upgrading to from v1.62 to v1.64 $ uname -a
Darwin 3c22fb40eee8 19.6.0 Darwin Kernel Version 19.6.0: Thu Jan 13 01:26:33 PST 2022; root:xnu-6153.141.51~3/RELEASE_X86_64 x86_64
$ echo $SHELL
/bin/zsh
$ bash -c 'echo ${BASH_VERSION}'
3.2.57(1)-release |
Just to compile main items that are required to keep compatibility with Bash v3:
My only concerns are the items apart from the very first one and the need to support quite ancient version of shell interpreter. Alternatively we can enforce Bash v4/v5 requirement. I realize this is intrusive for MacOS folks who are sort of enforced to use
The ➡️ IMHO |
rev - repo: https://github.com/antonbabenko/pre-commit-terraform
rev: 48bc03ca3f0f2f782d2f430069868019a6892062
hooks:
- id: terraform_fmt
- id: terraform_docs
args:
- '--args=--sort-by required' |
I was able to get around this with a
|
This issue has been resolved in version 1.64.1 🎉 |
Describe the bug
https://github.com/antonbabenko/pre-commit-terraform/blob/v1.63.0/hooks/_common.sh#L30 uses
declare -g
which is not an option in all bash versions.Tried with 2 different versions of bash.
and
Version v1.62.3 works fine.
The text was updated successfully, but these errors were encountered: