Skip to content
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

Shell scripts have bugs #110

Open
dougmill-ibm opened this issue Jun 26, 2017 · 0 comments
Open

Shell scripts have bugs #110

dougmill-ibm opened this issue Jun 26, 2017 · 0 comments

Comments

@dougmill-ibm
Copy link

dougmill-ibm commented Jun 26, 2017

There are several of the shell scripts that do not tolerate differences between Linux distros. These seem to be in the area of string comparisons where the strings might contain blanks or be empty (i.e. expressions are missing required quotes).

For example:

in htx_setup.sh: if [ $os_distribution == "Ubuntu" ]
or installer.sh: if [ $CURRENT_OS != $(cat os_build | grep Compiledon) ];

In both cases, other distros can produce strings with blanks in them causing these "if" statements to fail with syntax errors which causes other problems later.

All the shell scripts need to be scrubbed looking for this sort of mistake, and appropriate fixes applied.

Note, since most/all shell scripts use "bash" it might be better to use the bash native expression syntax [[ ... ]] rather than the out-dated Bourne shell/"test" syntax. The bash syntax is much more tolerant of blanks in strings, in addition to providing a more-complete and robust expression syntax. If the above "if" statements had been written with "[[ ... ]]" there would not have been any bug introduced.
However, if you do decide to change to "[[ ... ]]" beware that some operators must change. This could be done on a case-by-case basis as well, instead of converting all "if" expressions. However, a thorough fix would be to examine all "if" expressions for possible issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant