surrealdb / install.surrealdb.com

The script for installing SurrealDB on unix operating systems
https://install.surrealdb.com
Apache License 2.0
9 stars 6 forks source link

Fix install script, broken by introduction of nightly flag #2

Closed tekacs closed 1 year ago

tekacs commented 1 year ago

As of 02c1ec8bf248f4e2ec3a0b4262fb1873606aa543 the install script is broken, as it tries to dereference $1 unconditionally even though set -u is enabled for the file.

This introduces a check that it's set before trying to dereference it.

travishorn commented 1 year ago

Thank you for this fix. I was excited to try SurrealDB, but was instantly stopped by this issue on the very first step: running the install script! I will just add some information for those who might be searching for this.

When running the following command to install SurrealDB on Linux:

curl -sSf https://install.surrealdb.com | sh

I received this error:

main: line 58: $1: unbound variable

As stated by @tekacs above, the issue is that the install script tries to reference a positional $1 parameter. However, this parameter is not set. Since set -u is enabled for the file on line 15, the script throws an error.

The fix is to change line 58 to the following:

if [ -v 1 ] && [ "$1" != "--nightly" ]; then
tobiemh commented 1 year ago

Thanks for this pull request @travishorn 🚀👍!

kelvin2200 commented 1 year ago

install works now but on my machine it still throws a v not defined error