Skip to content

Error in install.sh caused by bad bash logic #672

Closed
@RichardBronosky

Description

Version Information

Version: Master

Description

When the var $CI is empty, the if condition is interpreted as missing an argument. It's a known but rare bug with a documented fix**. The error is:
./install.sh: line 271: [: ==: unary operator expected

I have already prepared a PR to fix this.

** The documented fix is in the footnote and reads:

As S.C. points out, in a compound test, even quoting the string variable might not suffice. [ -n "$string" -o "$a" = "$b" ] may cause an error with some versions of Bash if $string is empty. The safe way is to append an extra character to possibly empty variables, [ "x$string" != x -o "x$a" = "x$b" ] (the "x's" cancel out).

But, it's much more clear to just use [[ "new test" consistently since this script already used it in many places.
See: https://mywiki.wooledge.org/BashFAQ/031

Steps to Reproduce

Commands:
git clone https://github.com/getsentry/onpremise.git
git checkout 313fef0
cd onpremise
./install.sh

Observe:
./install.sh: line 271: [: ==: unary operator expected

Logs

sentry_install_log-2020-09-10_16-38-07.txt

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions