commit 729ea601c5ce2858bbf15f29b0f18d1beb4b4fb0 Author: teor teor2345@gmail.com Date: Mon Feb 27 15:19:39 2017 +1100
Check that relative paths actually have what we need in them
If they don't, use the script path.
Finally fixes #21521, I hope! --- tools/bootstrap-network.sh | 11 +++++++---- tools/hsaddress.sh | 11 +++++++---- tools/test-network.sh | 5 +++-- tools/warnings.sh | 11 +++++++---- 4 files changed, 24 insertions(+), 14 deletions(-)
diff --git a/tools/bootstrap-network.sh b/tools/bootstrap-network.sh index 438de62..ed1ddf3 100755 --- a/tools/bootstrap-network.sh +++ b/tools/bootstrap-network.sh @@ -13,11 +13,14 @@ # (default: 'basic') #
-# make chutney path absolute -if [ -d "$PWD/$CHUTNEY_PATH" ]; then +if [ ! -d "$CHUTNEY_PATH" -o ! -x "$CHUTNEY_PATH/chutney" ]; then + # looks like a broken path: use the path to this tool instead + TOOLS_PATH=`dirname "$0"` + export CHUTNEY_PATH=`dirname "$TOOLS_PATH"` +fi +if [ -d "$PWD/$CHUTNEY_PATH" -a -x "$PWD/$CHUTNEY_PATH/chutney" ]; then + # looks like a relative path: make chutney path absolute export CHUTNEY_PATH="$PWD/$CHUTNEY_PATH" -elif [ ! -d "$CHUTNEY_PATH" ]; then - export CHUTNEY_PATH="$PWD" fi
VOTING_OFFSET=6 diff --git a/tools/hsaddress.sh b/tools/hsaddress.sh index de6f023..5c8a828 100755 --- a/tools/hsaddress.sh +++ b/tools/hsaddress.sh @@ -7,11 +7,14 @@ # Examples: tools/hsaddress.sh # tools/hsaddress.sh 025h
-# make chutney path absolute -if [ -d "$PWD/$CHUTNEY_PATH" ]; then +if [ ! -d "$CHUTNEY_PATH" -o ! -x "$CHUTNEY_PATH/chutney" ]; then + # looks like a broken path: use the path to this tool instead + TOOLS_PATH=`dirname "$0"` + export CHUTNEY_PATH=`dirname "$TOOLS_PATH"` +fi +if [ -d "$PWD/$CHUTNEY_PATH" -a -x "$PWD/$CHUTNEY_PATH/chutney" ]; then + # looks like a relative path: make chutney path absolute export CHUTNEY_PATH="$PWD/$CHUTNEY_PATH" -elif [ ! -d "$CHUTNEY_PATH" ]; then - export CHUTNEY_PATH="$PWD" fi
NAME=$(basename "$0") diff --git a/tools/test-network.sh b/tools/test-network.sh index 547858f..a8d8bcd 100755 --- a/tools/test-network.sh +++ b/tools/test-network.sh @@ -146,7 +146,8 @@ if [ ! -d "$TOR_DIR" ]; then fi
# make TOR_DIR absolute -if [ -d "$PWD/$TOR_DIR" ]; then +if [ -d "$PWD/$TOR_DIR" -a -d "$PWD/$TOR_DIR/src/or" -a \ + -d "$PWD/$TOR_DIR/src/tools" ]; then export TOR_DIR="$PWD/$TOR_DIR" fi
@@ -184,7 +185,7 @@ CHUTNEY_PATH=`pwd`/chutney" fi
# make chutney path absolute -if [ -d "$PWD/$CHUTNEY_PATH" ]; then +if [ -d "$PWD/$CHUTNEY_PATH" -a -x "$PWD/$CHUTNEY_PATH/chutney" ]; then export CHUTNEY_PATH="$PWD/$CHUTNEY_PATH" fi
diff --git a/tools/warnings.sh b/tools/warnings.sh index 52187bd..bba2dcc 100755 --- a/tools/warnings.sh +++ b/tools/warnings.sh @@ -11,11 +11,14 @@ # CHUTNEY_WARNINGS_IGNORE_EXPECTED: set to "true" to filter expected warnings # CHUTNEY_WARNINGS_SUMMARY: set to "true" to merge warnings from all instances
-# make chutney path absolute -if [ -d "$PWD/$CHUTNEY_PATH" ]; then +if [ ! -d "$CHUTNEY_PATH" -o ! -x "$CHUTNEY_PATH/chutney" ]; then + # looks like a broken path: use the path to this tool instead + TOOLS_PATH=`dirname "$0"` + export CHUTNEY_PATH=`dirname "$TOOLS_PATH"` +fi +if [ -d "$PWD/$CHUTNEY_PATH" -a -x "$PWD/$CHUTNEY_PATH/chutney" ]; then + # looks like a relative path: make chutney path absolute export CHUTNEY_PATH="$PWD/$CHUTNEY_PATH" -elif [ ! -d "$CHUTNEY_PATH" ]; then - export CHUTNEY_PATH="$PWD" fi
function show_warnings() {