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
  1. brunoerg commented at 12:55 PM on March 18, 2022: member

    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.

  2. fanquake added the label Tests on Mar 18, 2022
  3. brunoerg marked this as a draft on Mar 18, 2022
  4. brunoerg force-pushed on Mar 18, 2022
  5. brunoerg marked this as ready for review on Mar 18, 2022
  6. w0xlt commented at 2:15 PM on March 18, 2022: contributor

    Concept ACK.

  7. test, lint: check bash version before executing codespell a5e5b6d412
  8. brunoerg force-pushed on Mar 18, 2022
  9. jessebarton commented at 10:49 PM on March 18, 2022: contributor

    Concept ACK a5e5b6d

    Code reviewed. Installed bash version 3 and confirmed code functioning as expected. image

  10. jessebarton approved
  11. 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 with 4.x (which was released in 2009).

    Given that, I'm ~0 on adding more code to warn for this case.

  12. 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 with 4.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.

  13. 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.

  14. 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 with 4.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.

  15. 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.

  16. fanquake closed this on Mar 23, 2022

  17. 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

  18. 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…

  19. MarcoFalke commented at 2:46 PM on April 4, 2022: member
  20. DrahtBot locked this on Apr 4, 2023

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-22 03:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me