jepsen-io / jepsen

A framework for distributed systems verification, with fault injection
6.69k stars 710 forks source link

POSITIONAL[@]: unbound variable #463

Open chengyu3075 opened 4 years ago

chengyu3075 commented 4 years ago

[root@bogon docker]# ./up.sh --dev ~/software/jepsen/jepsen-master/docker ~/software/jepsen/jepsen-master/docker [INFO] JEPSEN_ROOT is not set, defaulting to: /root/software/jepsen/jepsen-master [INFO] Running docker-compose with dev config ./up.sh: line 79: POSITIONAL[@]: unbound variable

yito88 commented 4 years ago

I modified up.sh script. It works well on macOS 10.15.4 with docker desktop 2.3.0.3.

diff --git a/docker/up.sh b/docker/up.sh
index 0f84f027..3d79dada 100755
--- a/docker/up.sh
+++ b/docker/up.sh
@@ -76,7 +76,7 @@ do
             ;;
     esac
 done
-set -- "${POSITIONAL[@]}" # restore positional parameters
+set -- "${POSITIONAL[@]+"${POSITIONAL[@]}"}" # restore positional parameters

 if [ "${HELP}" -eq 1 ]; then
     echo "Usage: $0 [OPTION]"
@@ -116,7 +116,7 @@ fi
 rm -rf ./control/jepsen
 mkdir -p ./control/jepsen/jepsen
 # Copy the jepsen directory if we're not mounting the JEPSEN_ROOT
-if [ -n "${DEV}" ]; then
+if [ -z "${DEV}" ]; then
     # Dockerfile does not allow `ADD ..`. So we need to copy it here in setup.
     INFO "Copying .. to control/jepsen"
     (