Skip to content

Bug in arduino-linux-setup.sh affecting non-bash users #9281

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

Closed
jwcollins opened this issue Oct 4, 2019 · 2 comments · Fixed by #9291
Closed

Bug in arduino-linux-setup.sh affecting non-bash users #9281

jwcollins opened this issue Oct 4, 2019 · 2 comments · Fixed by #9291
Labels
OS: Linux Specific to the Linux version of the Arduino IDE Type: Bug

Comments

@jwcollins
Copy link

Hi. This script has an obvious, but easily fixed bug. Currently there are a bunch of comments before #!/bin/bash. And it assumes, very incorrectly, that pound-bang /bin/bash is a comment. In fact, "#!" is a valid Unix/Linux magic number, and "/bin/bash" is the path to the program which needs to interpret / execute the script. When run by a user who uses /bin/bash as their everyday shell, it works, but only because the user happens to have invoked bash. But when run by a user who uses another shell (e.g. /bin/tcsh) as their shell, it doesn't work, because pound-bang is not at the top of the file, and thus /bin/bash is not invoked to execute the script. And since the script is written to bash, as opposed to tcsh (or ksh or ... ) syntax, it won't work.

This bug report is against distribution 1.8.10. Screen capture of trying to run this script from a non-bash shell is pasted below. Read the below wikipedia link, which mis-pronounces "pound-bang", but is otherwise valid. This construct has worked since handed down by Real Programmer Dennis Ritchie in Jan 1980. Please learn it.

https://en.wikipedia.org/wiki/Shebang_(Unix)

image

@per1234 per1234 added OS: Linux Specific to the Linux version of the Arduino IDE Type: Bug labels Oct 5, 2019
endorama added a commit that referenced this issue Oct 7, 2019
Shebang changes how Unix-like OS run scripts, ensuring the script is run with the specified interpreter. In this case as the line was not the first in the file, users without bash as their default shell would experience issues running the script.

Fixes #9281
More details on shebang usage here https://en.wikipedia.org/wiki/Shebang_(Unix)
@endorama
Copy link
Contributor

endorama commented Oct 7, 2019

Hi @jwcollins, I provided a PR to fix that.

Meanwhile you can try running the script with explicit interpreter, it should work.
Ex: /bin/bash ./arduino-linux-setup.sh

@jwcollins
Copy link
Author

jwcollins commented Oct 7, 2019

Thanks @endorama! --jwc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OS: Linux Specific to the Linux version of the Arduino IDE Type: Bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants