From f6b3382fa3cf988e7e80d0cab14393d4f9ec2113 Mon Sep 17 00:00:00 2001 From: practicalswift Date: Wed, 4 Oct 2017 19:58:51 +0200 Subject: [PATCH 1/8] Remove unused variables --- contrib/gitian-build.sh | 1 - contrib/verify-commits/verify-commits.sh | 2 -- contrib/verifybinaries/verify.sh | 2 -- 3 files changed, 5 deletions(-) diff --git a/contrib/gitian-build.sh b/contrib/gitian-build.sh index 8fdec21b0..511c1a4c4 100755 --- a/contrib/gitian-build.sh +++ b/contrib/gitian-build.sh @@ -6,7 +6,6 @@ sign=false verify=false build=false -setupenv=false # Systems to build linux=true diff --git a/contrib/verify-commits/verify-commits.sh b/contrib/verify-commits/verify-commits.sh index 7194b040e..85661f467 100755 --- a/contrib/verify-commits/verify-commits.sh +++ b/contrib/verify-commits/verify-commits.sh @@ -12,8 +12,6 @@ VERIFIED_ROOT=$(cat "${DIR}/trusted-git-root") VERIFIED_SHA512_ROOT=$(cat "${DIR}/trusted-sha512-root-commit") REVSIG_ALLOWED=$(cat "${DIR}/allow-revsig-commits") -HAVE_FAILED=false - HAVE_GNU_SHA512=1 [ ! -x "$(which sha512sum)" ] && HAVE_GNU_SHA512=0 diff --git a/contrib/verifybinaries/verify.sh b/contrib/verifybinaries/verify.sh index 409f517c9..320add64d 100755 --- a/contrib/verifybinaries/verify.sh +++ b/contrib/verifybinaries/verify.sh @@ -76,8 +76,6 @@ if [ -n "$1" ]; then BASEDIR="$BASEDIR$RCSUBDIR.$RCVERSION/" fi fi - - SIGNATUREFILE="$BASEDIR$SIGNATUREFILENAME" else echo "Error: need to specify a version on the command line" exit 2 From b9e79ab415996964cfdfaaa0f8dddbcda8aa7d32 Mon Sep 17 00:00:00 2001 From: practicalswift Date: Wed, 4 Oct 2017 21:15:55 +0200 Subject: [PATCH 2/8] Remove "\n" from echo argument. echo does not support escape sequences. --- contrib/gitian-build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/gitian-build.sh b/contrib/gitian-build.sh index 511c1a4c4..a7d9fe3be 100755 --- a/contrib/gitian-build.sh +++ b/contrib/gitian-build.sh @@ -105,7 +105,7 @@ while :; do fi shift else - echo 'Error: "--os" requires an argument containing an l (for linux), w (for windows), or x (for Mac OSX)\n' + echo 'Error: "--os" requires an argument containing an l (for linux), w (for windows), or x (for Mac OSX)' exit 1 fi ;; From 1e44ae0e198b0bc3c4363774a27a3e72a5c2a47b Mon Sep 17 00:00:00 2001 From: practicalswift Date: Wed, 4 Oct 2017 21:19:45 +0200 Subject: [PATCH 3/8] Add error handling: exit if cd fails --- contrib/tidy_datadir.sh | 2 +- contrib/verifybinaries/verify.sh | 2 +- share/genbuild.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/contrib/tidy_datadir.sh b/contrib/tidy_datadir.sh index 8960f8811..b845b34e4 100755 --- a/contrib/tidy_datadir.sh +++ b/contrib/tidy_datadir.sh @@ -4,7 +4,7 @@ # file COPYING or http://www.opensource.org/licenses/mit-license.php. if [ -d "$1" ]; then - cd "$1" + cd "$1" || exit 1 else echo "Usage: $0 " >&2 echo "Removes obsolete Bitcoin database files" >&2 diff --git a/contrib/verifybinaries/verify.sh b/contrib/verifybinaries/verify.sh index 320add64d..bf2a10337 100755 --- a/contrib/verifybinaries/verify.sh +++ b/contrib/verifybinaries/verify.sh @@ -33,7 +33,7 @@ if [ ! -d "$WORKINGDIR" ]; then mkdir "$WORKINGDIR" fi -cd "$WORKINGDIR" +cd "$WORKINGDIR" || exit 1 #test if a version number has been passed as an argument if [ -n "$1" ]; then diff --git a/share/genbuild.sh b/share/genbuild.sh index 32ef2a575..419e0da0f 100755 --- a/share/genbuild.sh +++ b/share/genbuild.sh @@ -4,7 +4,7 @@ # file COPYING or http://www.opensource.org/licenses/mit-license.php. if [ $# -gt 1 ]; then - cd "$2" + cd "$2" || exit 1 fi if [ $# -gt 0 ]; then FILE="$1" From 564a172dfdce5d0c234c271a7a521ef440ff5565 Mon Sep 17 00:00:00 2001 From: practicalswift Date: Wed, 4 Oct 2017 21:23:31 +0200 Subject: [PATCH 4/8] Add required space to [[ -n "$1" ]] (previously [[ -n"$1" ]]) --- contrib/gitian-build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/gitian-build.sh b/contrib/gitian-build.sh index a7d9fe3be..631fba908 100755 --- a/contrib/gitian-build.sh +++ b/contrib/gitian-build.sh @@ -188,7 +188,7 @@ then fi # Get signer -if [[ -n"$1" ]] +if [[ -n "$1" ]] then SIGNER=$1 shift From 80f5f28d38e59b550ab7e7465cfa48defee343a6 Mon Sep 17 00:00:00 2001 From: practicalswift Date: Wed, 4 Oct 2017 21:25:25 +0200 Subject: [PATCH 5/8] Fix incorrect quoting of quotes (the previous quotes had no effect beyond unquoting) --- contrib/macdeploy/detached-sig-create.sh | 2 +- contrib/verify-commits/verify-commits.sh | 2 +- contrib/verifybinaries/verify.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/contrib/macdeploy/detached-sig-create.sh b/contrib/macdeploy/detached-sig-create.sh index 7f017bb4f..3379a4599 100755 --- a/contrib/macdeploy/detached-sig-create.sh +++ b/contrib/macdeploy/detached-sig-create.sh @@ -40,7 +40,7 @@ grep CodeResources < "${TEMPLIST}" | while read i; do RESOURCE="${TEMPDIR}/${OUTROOT}/${TARGETFILE}" DIRNAME="`dirname "${RESOURCE}"`" mkdir -p "${DIRNAME}" - echo "Adding resource for: "${TARGETFILE}"" + echo "Adding resource for: \"${TARGETFILE}\"" cp "${i}" "${RESOURCE}" done diff --git a/contrib/verify-commits/verify-commits.sh b/contrib/verify-commits/verify-commits.sh index 85661f467..98ee243ea 100755 --- a/contrib/verify-commits/verify-commits.sh +++ b/contrib/verify-commits/verify-commits.sh @@ -36,7 +36,7 @@ PREV_COMMIT="" while true; do if [ "$CURRENT_COMMIT" = $VERIFIED_ROOT ]; then - echo "There is a valid path from "$CURRENT_COMMIT" to $VERIFIED_ROOT where all commits are signed!" + echo "There is a valid path from \"$CURRENT_COMMIT\" to $VERIFIED_ROOT where all commits are signed!" exit 0 fi diff --git a/contrib/verifybinaries/verify.sh b/contrib/verifybinaries/verify.sh index bf2a10337..e0266bf08 100755 --- a/contrib/verifybinaries/verify.sh +++ b/contrib/verifybinaries/verify.sh @@ -87,7 +87,7 @@ WGETOUT=$(wget -N "$HOST1$BASEDIR$SIGNATUREFILENAME" 2>&1) #and then see if wget completed successfully if [ $? -ne 0 ]; then echo "Error: couldn't fetch signature file. Have you specified the version number in the following format?" - echo "[$VERSIONPREFIX]-[$RCVERSIONSTRING[0-9]] (example: "$VERSIONPREFIX"0.10.4-"$RCVERSIONSTRING"1)" + echo "[$VERSIONPREFIX]-[$RCVERSIONSTRING[0-9]] (example: ${VERSIONPREFIX}0.10.4-${RCVERSIONSTRING}1)" echo "wget output:" echo "$WGETOUT"|sed 's/^/\t/g' exit 2 From 193c2fb4c88fbc4e0b19033ed9c0351ac1f02269 Mon Sep 17 00:00:00 2001 From: practicalswift Date: Wed, 4 Oct 2017 21:32:21 +0200 Subject: [PATCH 6/8] Use bash instead of POSIX sh. POSIX sh does not support arrays. --- contrib/devtools/gen-manpages.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/devtools/gen-manpages.sh b/contrib/devtools/gen-manpages.sh index 967717e1e..925d6a625 100755 --- a/contrib/devtools/gen-manpages.sh +++ b/contrib/devtools/gen-manpages.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash TOPDIR=${TOPDIR:-$(git rev-parse --show-toplevel)} SRCDIR=${SRCDIR:-$TOPDIR/src} From 683b9d280bba7a0f0f78818e5e29a21cef2eb5e6 Mon Sep 17 00:00:00 2001 From: practicalswift Date: Mon, 9 Oct 2017 23:20:52 +0200 Subject: [PATCH 7/8] Fix valid path output --- contrib/verify-commits/verify-commits.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/verify-commits/verify-commits.sh b/contrib/verify-commits/verify-commits.sh index 98ee243ea..9ba01791a 100755 --- a/contrib/verify-commits/verify-commits.sh +++ b/contrib/verify-commits/verify-commits.sh @@ -33,10 +33,11 @@ fi NO_SHA1=1 PREV_COMMIT="" +INITIAL_COMMIT=${CURRENT_COMMIT} while true; do if [ "$CURRENT_COMMIT" = $VERIFIED_ROOT ]; then - echo "There is a valid path from \"$CURRENT_COMMIT\" to $VERIFIED_ROOT where all commits are signed!" + echo "There is a valid path from \"$INITIAL_COMMIT\" to $VERIFIED_ROOT where all commits are signed!" exit 0 fi From 13a81b19df7acff51187655bb755f1371f9c83ca Mon Sep 17 00:00:00 2001 From: practicalswift Date: Wed, 18 Oct 2017 07:34:25 +0200 Subject: [PATCH 8/8] Add quotes to variable assignment (as requested by @TheBlueMatt) --- contrib/verify-commits/verify-commits.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/verify-commits/verify-commits.sh b/contrib/verify-commits/verify-commits.sh index 9ba01791a..78320a4ce 100755 --- a/contrib/verify-commits/verify-commits.sh +++ b/contrib/verify-commits/verify-commits.sh @@ -33,7 +33,7 @@ fi NO_SHA1=1 PREV_COMMIT="" -INITIAL_COMMIT=${CURRENT_COMMIT} +INITIAL_COMMIT="${CURRENT_COMMIT}" while true; do if [ "$CURRENT_COMMIT" = $VERIFIED_ROOT ]; then