return code checking in install_rally.sh doesn't work
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Rally |
Fix Released
|
Medium
|
Albert White |
Bug Description
in install_rally.sh we do
set -e
...
args=$(getopt --name "$PROG" --shell sh -l "$long_opts" -o "$short_opts" -- "$@")
if [ $? -ne 0 ]; then
...
set -e instructs the shell to exit when a command returns a non zero error code so if getopt fails we never make it into the if conditions to proceed.
A solution is to allow shell commands to give non zero return codes around this piece of code:
diff --git a/install_rally.sh b/install_rally.sh
index 1f15fd3..d606d4c 100755
--- a/install_rally.sh
+++ b/install_rally.sh
@@ -460,6 +460,7 @@ setup_rally_
short_
long_opts=
+set +e
if [ "x$(getopt -T)" = 'x' ]; then
# GNU getopt
args=$(getopt --name "$PROG" --shell sh -l "$long_opts" -o "$short_opts" -- "$@")
@@ -472,10 +473,11 @@ else
# old-style getopt, use compatibility syntax
args=$(getopt "$short_opts" "$@")
if [ $? -ne 0 ]; then
- abort 1 "Type '$PROG --help' to get usage information."
+ abort 1 "Type '$PROG -h' to get usage information."
fi
eval set -- "$args"
fi
+set -e
# Command line parsing
while true
Changed in rally: | |
assignee: | nobody → Albert White (albertw) |
description: | updated |
Changed in rally: | |
status: | New → In Progress |
Changed in rally: | |
importance: | Undecided → Medium |
milestone: | none → 0.1.0 |
Changed in rally: | |
status: | In Progress → Fix Committed |
Changed in rally: | |
status: | Fix Committed → Fix Released |