Skip to content

Shell scripts have bugs #110

@dougmill-ibm

Description

@dougmill-ibm

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions