Skip to content

Conversation

brunoerg
Copy link
Contributor

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.

@fanquake fanquake added the Tests label Mar 18, 2022
@brunoerg brunoerg marked this pull request as draft March 18, 2022 14:03
@brunoerg brunoerg force-pushed the 2022-03-bash-lint-spelling branch from 3c8b40d to 8c2b102 Compare March 18, 2022 14:06
@brunoerg brunoerg marked this pull request as ready for review March 18, 2022 14:06
@w0xlt
Copy link
Contributor

w0xlt commented Mar 18, 2022

Concept ACK.

@brunoerg brunoerg force-pushed the 2022-03-bash-lint-spelling branch from 8c2b102 to a5e5b6d Compare March 18, 2022 19:15
@jessebarton
Copy link
Contributor

jessebarton commented Mar 18, 2022

Concept ACK a5e5b6d

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

@fanquake
Copy link
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.

@brunoerg
Copy link
Contributor Author

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.

@fanquake
Copy link
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
Copy link
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.

@fanquake
Copy link
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.

@fjahr
Copy link
Contributor

fjahr commented Apr 3, 2022

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
Copy link
Member

laanwj commented Apr 4, 2022

This kind of issues keep coming up. Can we please port scripts like this to Python…

@maflcko
Copy link
Member

maflcko commented Apr 4, 2022

Started in #24762

@bitcoin bitcoin locked and limited conversation to collaborators Apr 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants