Skip to content

Commit

Permalink
Quote stuff properly
Browse files Browse the repository at this point in the history
  • Loading branch information
cameel committed Feb 1, 2021
1 parent 566d49a commit 27754d3
Show file tree
Hide file tree
Showing 27 changed files with 124 additions and 124 deletions.
4 changes: 2 additions & 2 deletions .circleci/soltest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ set -e

OPTIMIZE=${OPTIMIZE:-"0"}
EVM=${EVM:-"invalid"}
REPODIR="$(realpath $(dirname $0)/..)"
REPODIR="$(realpath "$(dirname "$0")/..")"

source "${REPODIR}/scripts/common.sh"
# Test result output directory (CircleCI is reading test results from here)
Expand All @@ -60,4 +60,4 @@ test "${ABI_ENCODER_V1}" = "1" && SOLTEST_ARGS="${SOLTEST_ARGS} --abiencoderv1"

echo "Running ${REPODIR}/build/test/soltest ${BOOST_TEST_ARGS} -- ${SOLTEST_ARGS}"

${REPODIR}/build/test/soltest ${BOOST_TEST_ARGS} -- ${SOLTEST_ARGS}
"${REPODIR}/build/test/soltest" ${BOOST_TEST_ARGS} -- ${SOLTEST_ARGS}
6 changes: 3 additions & 3 deletions .circleci/soltest_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
# ------------------------------------------------------------------------------
set -e

REPODIR="$(realpath $(dirname $0)/..)"
REPODIR="$(realpath "$(dirname "$0")"/..)"

EVM_VALUES=(homestead byzantium constantinople petersburg istanbul)
OPTIMIZE_VALUES=(0 1)
Expand Down Expand Up @@ -65,9 +65,9 @@ STEP=$(($STEP + 1))
[[ " $RUN_STEPS " =~ " $STEP " ]] && EVM=istanbul OPTIMIZE=1 ABI_ENCODER_V1=1 BOOST_TEST_ARGS="-t !smtCheckerTests" "${REPODIR}/.circleci/soltest.sh"
STEP=$(($STEP + 1))

for OPTIMIZE in ${OPTIMIZE_VALUES[@]}
for OPTIMIZE in "${OPTIMIZE_VALUES[@]}"
do
for EVM in ${EVM_VALUES[@]}
for EVM in "${EVM_VALUES[@]}"
do
# run tests against hera ewasm evmc vm, only if OPTIMIZE == 0 and evm version is byzantium
EWASM_ARGS=""
Expand Down
26 changes: 13 additions & 13 deletions scripts/ASTImportTest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ SPLITSOURCES=${REPO_ROOT}/scripts/splitSources.py

SYNTAXTESTS_DIR="${REPO_ROOT}/test/libsolidity/syntaxTests"
ASTJSONTESTS_DIR="${REPO_ROOT}/test/libsolidity/ASTJSON"
NSOURCES="$(find $SYNTAXTESTS_DIR -type f | wc -l)"
NSOURCES="$(find "$SYNTAXTESTS_DIR" -type f | wc -l)"

# DEV_DIR="${REPO_ROOT}/../tmp/contracts/"
# NSOURCES="$(find $DEV_DIR -type f | wc -l)" #TODO use find command
Expand All @@ -25,7 +25,7 @@ FAILED=0
UNCOMPILABLE=0
TESTED=0

if [ $(ls | wc -l) -ne 0 ]; then
if [ "$(ls | wc -l)" -ne 0 ]; then
echo "Test directory not empty. Skipping!"
exit -1
fi
Expand All @@ -37,10 +37,10 @@ fi
# $1 name of the file to be exported and imported
# $2 any files needed to do so that might be in parent directories
function testImportExportEquivalence {
if $SOLC $1 $2 > /dev/null 2>&1
if $SOLC "$1" $2 > /dev/null 2>&1
then
# save exported json as expected result (silently)
$SOLC --combined-json ast,compact-format --pretty-json $1 $2> expected.json 2> /dev/null
$SOLC --combined-json ast,compact-format --pretty-json "$1" $2 > expected.json 2> /dev/null
# import it, and export it again as obtained result (silently)
$SOLC --import-ast --combined-json ast,compact-format --pretty-json expected.json > obtained.json 2> /dev/null
if [ $? -ne 0 ]
Expand Down Expand Up @@ -81,15 +81,15 @@ echo "Looking at $NSOURCES .sol files..."
WORKINGDIR=$PWD

# for solfile in $(find $DEV_DIR -name *.sol)
for solfile in $(find $SYNTAXTESTS_DIR $ASTJSONTESTS_DIR -name *.sol)
for solfile in $(find "$SYNTAXTESTS_DIR" "$ASTJSONTESTS_DIR" -name *.sol)
do
echo -n "."
# create a temporary sub-directory
FILETMP=$(mktemp -d)
cd $FILETMP
cd "$FILETMP"

set +e
OUTPUT=$($SPLITSOURCES $solfile)
OUTPUT=$("$SPLITSOURCES" "$solfile")
SPLITSOURCES_RC=$?
set -e
if [ ${SPLITSOURCES_RC} == 0 ]
Expand All @@ -103,29 +103,29 @@ do
done
elif [ ${SPLITSOURCES_RC} == 1 ]
then
testImportExportEquivalence $solfile
testImportExportEquivalence "$solfile"
elif [ ${SPLITSOURCES_RC} == 2 ]
then
# The script will exit with return code 2, if an UnicodeDecodeError occurred.
# This is the case if e.g. some tests are using invalid utf-8 sequences. We will ignore
# these errors, but print the actual output of the script.
echo -e "\n${OUTPUT}\n"
testImportExportEquivalence $solfile
testImportExportEquivalence "$solfile"
else
# All other return codes will be treated as critical errors. The script will exit.
echo -e "\nGot unexpected return code ${SPLITSOURCES_RC} from ${SPLITSOURCES}. Aborting."
echo -e "\n${OUTPUT}\n"

cd $WORKINGDIR
cd "$WORKINGDIR"
# Delete temporary files
rm -rf $FILETMP
rm -rf "$FILETMP"

exit 1
fi

cd $WORKINGDIR
cd "$WORKINGDIR"
# Delete temporary files
rm -rf $FILETMP
rm -rf "$FILETMP"
done

echo ""
Expand Down
4 changes: 2 additions & 2 deletions scripts/build_emscripten.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ else
fi

# solbuildpackpusher/solidity-buildpack-deps:emscripten-4
docker run -v $(pwd):/root/project -w /root/project \
docker run -v "$(pwd):/root/project" -w /root/project \
solbuildpackpusher/solidity-buildpack-deps@sha256:434719d8104cab47712dd1f56f255994d04eb65b802c0d382790071c1a0c074b \
./scripts/ci/build_emscripten.sh $BUILD_DIR
./scripts/ci/build_emscripten.sh "$BUILD_DIR"
2 changes: 1 addition & 1 deletion scripts/bytecodecompare/storebytecode.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ TMPDIR=$(mktemp -d)
git clone --depth 1 https://github.com/ethereum/solc-js.git solc-js
( cd solc-js; npm install )
cp "$REPO_ROOT/emscripten_build/libsolc/soljson.js" solc-js/
cp ""$REPO_ROOT"/scripts/bytecodecompare/prepare_report.js" .
cp "$REPO_ROOT/scripts/bytecodecompare/prepare_report.js" .
echo "Running the compiler..."
./prepare_report.js *.sol > report.txt
echo "Finished running the compiler."
Expand Down
8 changes: 4 additions & 4 deletions scripts/ci/build_emscripten.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ then
echo -n "$CIRCLE_SHA1" >commit_hash.txt
fi

mkdir -p $BUILD_DIR
cd $BUILD_DIR
mkdir -p "$BUILD_DIR"
cd "$BUILD_DIR"
emcmake cmake \
-DCMAKE_BUILD_TYPE=Release \
-DBoost_USE_STATIC_LIBS=1 \
Expand All @@ -75,8 +75,8 @@ sed -i -e 's/addFunction(func,sig){/addFunction(func,sig){sig=sig||"viiiii";/' l

cd ..
mkdir -p upload
cp $BUILD_DIR/libsolc/soljson.js upload/
cp $BUILD_DIR/libsolc/soljson.js ./
cp "$BUILD_DIR/libsolc/soljson.js" upload/
cp "$BUILD_DIR/libsolc/soljson.js" ./

OUTPUT_SIZE=`ls -la soljson.js`

Expand Down
4 changes: 2 additions & 2 deletions scripts/common_cmdline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ function compileFull()
fi
local args=$FULLARGS
if [[ $1 = '-v' ]]; then
if (echo $2 | grep -Po '(?<=0.4.)\d+' >/dev/null); then
patch=$(echo $2 | grep -Po '(?<=0.4.)\d+')
if (echo "$2" | grep -Po '(?<=0.4.)\d+' >/dev/null); then
patch=$(echo "$2" | grep -Po '(?<=0.4.)\d+')
if (( patch < 22 )); then
args=$OLDARGS
fi
Expand Down
22 changes: 11 additions & 11 deletions scripts/deps-ppa/static_z3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ DISTRIBUTIONS="focal groovy"
for distribution in $DISTRIBUTIONS
do
cd /tmp/
rm -rf $distribution
mkdir $distribution
cd $distribution
rm -rf "$distribution"
mkdir "$distribution"
cd "$distribution"

pparepo=cpp-build-deps
ppafilesurl=https://launchpad.net/~ethereum/+archive/ubuntu/${pparepo}/+files
Expand Down Expand Up @@ -190,7 +190,7 @@ echo "3.0 (quilt)" > debian/source/format
chmod +x debian/rules

versionsuffix=1ubuntu0~${distribution}
EMAIL="$email" dch -v 1:${debversion}-${versionsuffix} "build of ${version}"
EMAIL="$email" dch -v "1:${debversion}-${versionsuffix}" "build of ${version}"

# build source package
# If packages is rejected because original source is already present, add
Expand All @@ -199,13 +199,13 @@ EMAIL="$email" dch -v 1:${debversion}-${versionsuffix} "build of ${version}"
debuild -S -d -sa -us -uc

# prepare .changes file for Launchpad
sed -i -e s/UNRELEASED/${distribution}/ -e s/urgency=medium/urgency=low/ ../*.changes
sed -i -e "s/UNRELEASED/${distribution}/" -e s/urgency=medium/urgency=low/ ../*.changes

# check if ubuntu already has the source tarball
(
cd ..
orig=${packagename}_${debversion}.orig.tar.gz
orig_size=$(ls -l $orig | cut -d ' ' -f 5)
orig="${packagename}_${debversion}.orig.tar.gz"
orig_size=$(ls -l "$orig" | cut -d ' ' -f 5)
orig_sha1=$(sha1sum $orig | cut -d ' ' -f 1)
orig_sha256=$(sha256sum $orig | cut -d ' ' -f 1)
orig_md5=$(md5sum $orig | cut -d ' ' -f 1)
Expand All @@ -218,15 +218,15 @@ then
new_sha1=$(sha1sum $orig | cut -d ' ' -f 1)
new_sha256=$(sha256sum $orig | cut -d ' ' -f 1)
new_md5=$(md5sum $orig | cut -d ' ' -f 1)
sed -i -e s,$orig_sha1,$new_sha1,g -e s,$orig_sha256,$new_sha256,g -e s,$orig_size,$new_size,g -e s,$orig_md5,$new_md5,g *.dsc
sed -i -e s,$orig_sha1,$new_sha1,g -e s,$orig_sha256,$new_sha256,g -e s,$orig_size,$new_size,g -e s,$orig_md5,$new_md5,g *.changes
sed -i -e "s,$orig_sha1,$new_sha1,g" -e "s,$orig_sha256,$new_sha256,g" -e "s,$orig_size,$new_size,g" -e "s,$orig_md5,$new_md5,g" *.dsc
sed -i -e "s,$orig_sha1,$new_sha1,g" -e "s,$orig_sha256,$new_sha256,g" -e "s,$orig_size,$new_size,g" -e "s,$orig_md5,$new_md5,g" *.changes
fi
)

# sign the package
debsign --re-sign -k ${keyid} ../${packagename}_${debversion}-${versionsuffix}_source.changes
debsign --re-sign -k "${keyid}" "../${packagename}_${debversion}-${versionsuffix}_source.changes"

# upload
dput ${pparepo} ../${packagename}_${debversion}-${versionsuffix}_source.changes
dput "${pparepo}" "../${packagename}_${debversion}-${versionsuffix}_source.changes"

done
4 changes: 2 additions & 2 deletions scripts/docker_deploy_manual.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ git clone --depth 2 https://github.com/ethereum/solidity.git -b "$branch"
cd solidity
commithash=$(git rev-parse --short=8 HEAD)
echo -n "$commithash" > commit_hash.txt
version=$($(dirname "$0")/get_version.sh)
version=$("$(dirname "$0")/get_version.sh")
if [ "$branch" = "release" -o "$branch" = v"$version" ]
then
echo -n > prerelease.txt
Expand All @@ -40,7 +40,7 @@ tmp_container=$(docker create "$image":build sh)

# Alpine image
mkdir -p upload
docker cp ${tmp_container}:/usr/bin/solc upload/solc-static-linux
docker cp "${tmp_container}":/usr/bin/solc upload/solc-static-linux
docker build -t "$image":build-alpine -f scripts/Dockerfile_alpine .

if [ "$branch" = "develop" ]
Expand Down
16 changes: 8 additions & 8 deletions scripts/docs_version_pragma_check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ set -e

## GLOBAL VARIABLES

REPO_ROOT=$(cd $(dirname "$0")/.. && pwd)
REPO_ROOT=$(cd "$(dirname "$0")/.." && pwd)
SOLIDITY_BUILD_DIR=${SOLIDITY_BUILD_DIR:-${REPO_ROOT}/build}
source "${REPO_ROOT}/scripts/common.sh"
source "${REPO_ROOT}/scripts/common_cmdline.sh"
Expand All @@ -41,13 +41,13 @@ function versionGreater()
ver1=( ${v1//./ } )
ver2=( ${v2//./ } )

if (( ${ver1[0]} > ${ver2[0]} ))
if (( "${ver1[0]}" > "${ver2[0]}" ))
then
return 0
elif (( ${ver1[0]} == ${ver2[0]} )) && (( ${ver1[1]} > ${ver2[1]} ))
elif (( "${ver1[0]}" == "${ver2[0]}" )) && (( "${ver1[1]}" > "${ver2[1]}" ))
then
return 0
elif (( ${ver1[0]} == ${ver2[0]} )) && (( ${ver1[1]} == ${ver2[1]} )) && (( ${ver1[2]} > ${ver2[2]} ))
elif (( "${ver1[0]}" == "${ver2[0]}" )) && (( "${ver1[1]}" == "${ver2[1]}" )) && (( "${ver1[2]}" > "${ver2[2]}" ))
then
return 0
fi
Expand Down Expand Up @@ -75,7 +75,7 @@ function getAllAvailableVersions()
do
if versionGreater "$listed" "0.4.10"
then
allVersions+=( $listed )
allVersions+=( "$listed" )
fi
done
}
Expand Down Expand Up @@ -157,7 +157,7 @@ SOLTMPDIR=$(mktemp -d)
# ignore warnings in this case
opts="$opts -o"

findMinimalVersion $f
findMinimalVersion "$f"
if [[ "$version" == "" ]]
then
continue
Expand All @@ -175,9 +175,9 @@ SOLTMPDIR=$(mktemp -d)
if [[ ! -f "$solc_bin" ]]
then
echo "Downloading release from github..."
if wget -q https://github.com/ethereum/solidity/releases/download/v$version/solc-static-linux >/dev/null
if wget -q "https://github.com/ethereum/solidity/releases/download/v$version/solc-static-linux" >/dev/null
then
mv solc-static-linux $solc_bin
mv solc-static-linux "$solc_bin"
else
printError "No release $version was found on github!"
continue
Expand Down
6 changes: 3 additions & 3 deletions scripts/endToEndExtraction/create_traces.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ cmake ../../../
make soltest
cd test/ || exit
echo "running soltest on 'semanticTests/extracted'..."
./soltest --color_output=false --log_level=test_suite -t semanticTests/extracted/ -- --testpath ${BASE_PATH}/../../test --no-smt --evmonepath /Users/alex/evmone/lib/libevmone.dylib --show-messages --show-metadata > ${BASE_PATH}/extracted-tests.trace
./soltest --color_output=false --log_level=test_suite -t semanticTests/extracted/ -- --testpath "${BASE_PATH}/../../test" --no-smt --evmonepath /Users/alex/evmone/lib/libevmone.dylib --show-messages --show-metadata > "${BASE_PATH}/extracted-tests.trace"
echo "running soltest on 'semanticTests/extracted'... done"

cd $BASE_PATH || exit
cd "$BASE_PATH" || exit
git clone git@github.com:ethereum/solidity.git solidity-develop
cd solidity-develop || exit
mkdir -p build
Expand All @@ -18,5 +18,5 @@ cmake ..
make soltest
cd test/ || exit
echo "running soltest on 'SolidityEndToEndTest'..."
./soltest --color_output=false --log_level=test_suite -t SolidityEndToEndTest/ -- --testpath ${BASE_PATH}/solidity-develop/test --no-smt --evmonepath /Users/alex/evmone/lib/libevmone.dylib --show-messages --show-metadata > ${BASE_PATH}/endToEndExtraction-tests.trace
./soltest --color_output=false --log_level=test_suite -t SolidityEndToEndTest/ -- --testpath "${BASE_PATH}/solidity-develop/test" --no-smt --evmonepath /Users/alex/evmone/lib/libevmone.dylib --show-messages --show-metadata > "${BASE_PATH}/endToEndExtraction-tests.trace"
echo "running soltest on 'SolidityEndToEndTest'... done"
2 changes: 1 addition & 1 deletion scripts/get_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@

set -e

grep -oP "PROJECT_VERSION \"?\K[0-9.]+(?=\")?" $(dirname "$0")/../CMakeLists.txt
grep -oP "PROJECT_VERSION \"?\K[0-9.]+(?=\")?" "$(dirname "$0")/../CMakeLists.txt"
4 changes: 2 additions & 2 deletions scripts/install_cmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if test -f $BIN/cmake && ($BIN/cmake --version | grep -q "$VERSION"); then
else
FILE=cmake-$VERSION-$OS-x86_64.tar.gz
URL=https://cmake.org/files/v$VERSION_MAJOR.$VERSION_MINOR/$FILE
TMPFILE=$(mktemp --tmpdir cmake-$VERSION-$OS-x86_64.XXXXXXXX.tar.gz)
TMPFILE=$(mktemp --tmpdir "cmake-$VERSION-$OS-x86_64.XXXXXXXX.tar.gz")
echo "Downloading CMake ($URL)..."
wget "$URL" -O "$TMPFILE" -nv
if ! (shasum -a256 "$TMPFILE" | grep -q "$SHA256"); then
Expand All @@ -36,5 +36,5 @@ else
fi
mkdir -p "$PREFIX"
tar xzf "$TMPFILE" -C "$PREFIX" --strip 1
rm $TMPFILE
rm "$TMPFILE"
fi
6 changes: 3 additions & 3 deletions scripts/install_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ uname -v > /dev/null 2>&1 || { echo >&2 "ERROR - solidity requires 'uname' to id

# See http://unix.stackexchange.com/questions/92199/how-can-i-reliably-get-the-operating-systems-name
detect_linux_distro() {
if [ $(command -v lsb_release) ]; then
if [ "$(command -v lsb_release)" ]; then
DISTRO=$(lsb_release -is)
elif [ -f /etc/os-release ]; then
# extract 'foo' from NAME=foo, only on the line with NAME=foo
Expand All @@ -61,7 +61,7 @@ detect_linux_distro() {
else
DISTRO=''
fi
echo $DISTRO
echo "$DISTRO"
}

case $(uname -s) in
Expand Down Expand Up @@ -321,7 +321,7 @@ case $(uname -s) in
;;
*)
#other Ubuntu
echo "ERROR - Unknown or unsupported Ubuntu version (" $(lsb_release -cs) ")"
echo "ERROR - Unknown or unsupported Ubuntu version ($(lsb_release -cs))"
echo "ERROR - This might not work, but we are trying anyway."
echo "Please drop us a message at https://gitter.im/ethereum/solidity-dev."
echo "We only support Trusty, Utopic, Vivid, Wily, Xenial, Yakkety, Zesty, Artful and Bionic."
Expand Down
4 changes: 2 additions & 2 deletions scripts/install_obsolete_jsoncpp_1_7_4.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -e

TEMPDIR=$(mktemp -d)
(
cd $TEMPDIR
cd "$TEMPDIR"
wget https://github.com/open-source-parsers/jsoncpp/archive/1.7.4.tar.gz
tar xvzf "1.7.4.tar.gz"
cd "jsoncpp-1.7.4"
Expand All @@ -13,4 +13,4 @@ TEMPDIR=$(mktemp -d)
make
make install
)
rm -rf $TEMPDIR
rm -rf "$TEMPDIR"
2 changes: 1 addition & 1 deletion scripts/isoltest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
set -e

REPO_ROOT="$(dirname "$0")"/..
exec ${REPO_ROOT}/build/test/tools/isoltest --testpath ${REPO_ROOT}/test
exec "${REPO_ROOT}/build/test/tools/isoltest" --testpath "${REPO_ROOT}/test"
Loading

0 comments on commit 27754d3

Please sign in to comment.