When executing lint-spelling.sh I noticed mapfile command wasn't working so it wasn't ignoring the files that should be ignored giving me some false flags. I noticed the problem is the version of bash, mapfile was introduced in bash 4 and my machine had the 3 one. So, I added a verification to skip it if the version of bash is less than 4.
test, lint: check bash version before executing codespell #24610
pull brunoerg wants to merge 1 commits into bitcoin:master from brunoerg:2022-03-bash-lint-spelling changing 1 files +3 −0-
brunoerg commented at 12:55 PM on March 18, 2022: member
- fanquake added the label Tests on Mar 18, 2022
- brunoerg marked this as a draft on Mar 18, 2022
- brunoerg force-pushed on Mar 18, 2022
- brunoerg marked this as ready for review on Mar 18, 2022
-
w0xlt commented at 2:15 PM on March 18, 2022: contributor
Concept ACK.
-
test, lint: check bash version before executing codespell a5e5b6d412
- brunoerg force-pushed on Mar 18, 2022
-
jessebarton commented at 10:49 PM on March 18, 2022: contributor
Concept ACK
a5e5b6dCode reviewed. Installed bash version 3 and confirmed code functioning as expected.

- jessebarton approved
-
fanquake commented at 11:53 AM on March 21, 2022: member
and my machine had the 3 one
What system / OS was this? Does everything else work? Judging by https://repology.org/project/bash/versions, there is no recently released version of any OS that ships with Bash
3.x. Even ancient CentOS / Debian / Ubuntu all shipped with4.x(which was released in 2009).Given that, I'm ~0 on adding more code to warn for this case.
-
brunoerg commented at 12:09 PM on March 21, 2022: member
What system / OS was this? Does everything else work? Judging by https://repology.org/project/bash/versions, there is no recently released version of any OS that ships with Bash
3.x. Even ancient CentOS / Debian / Ubuntu all shipped with4.x(which was released in 2009). @fanquake I use MacOS and most versions (I think) are stuck in 3.x giving its license. So, since mapfile doesn't work in 3.x, the script doesn't "fail", it runs ignoring that certain files should be skipped, giving me some false flags. -
fanquake commented at 1:42 PM on March 21, 2022: member
I use MacOS and most versions (I think) are stuck in 3.x giving its license.
macOS swapped it's default shell away from bash > 2 years ago, with the release of
10.15, which also happens to be the oldest version of macOS our release binaries will run on. I'd suggest installing, and switching to any other modern shell. -
jessebarton commented at 2:52 AM on March 22, 2022: contributor
and my machine had the 3 one
What system / OS was this? Does everything else work? Judging by https://repology.org/project/bash/versions, there is no recently released version of any OS that ships with Bash
3.x. Even ancient CentOS / Debian / Ubuntu all shipped with4.x(which was released in 2009).Given that, I'm ~0 on adding more code to warn for this case.
Very good point, I had to download the bash source from the official GNU site to even get a binary I could test with. I agree its probably not worth adding code for this.
-
fanquake commented at 2:02 PM on March 23, 2022: member
Thanks, however I'm going to close this PR. I don't think we should be adding more code to our scripts, to better support Bash 3. I would suggest either swapping to the macOS default shell (zsh), or installing and using a modern Bash, i.e Bash 5.1 via homebrew: https://formulae.brew.sh/formula/bash.
- fanquake closed this on Mar 23, 2022
-
fjahr commented at 11:05 PM on April 3, 2022: member
I would suggest either swapping to the macOS default shell (zsh), or installing and using a modern Bash, i.e Bash 5.1 via homebrew: https://formulae.brew.sh/formula/bash.
I ran into this today and from my understanding it's still annoying, especially if you are starting out on a new macOS system. I am suggesting at least adding some docs on this since it would have saved me some time, see #24750
-
laanwj commented at 1:44 PM on April 4, 2022: member
This kind of issues keep coming up. Can we please port scripts like this to Python…
-
MarcoFalke commented at 2:46 PM on April 4, 2022: member
- DrahtBot locked this on Apr 4, 2023