Merge pull request #10585 from ethereum/fix-quoting-and-whitespace-in-shell-scripts

Fix quoting in shell scripts
This commit is contained in:
Leonardo 2021-02-03 11:27:40 +01:00 committed by GitHub
commit d393624384
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 137 additions and 155 deletions

View File

@ -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)
@ -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}

View File

@ -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)
@ -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=""

View File

@ -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
@ -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
@ -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 ]
@ -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 ]
@ -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 ""

View File

@ -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"

View File

@ -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."

View File

@ -17,8 +17,8 @@ find . -type f -name "*.sh" | sort >"${FOUND_FILES_TMP}"
SHELLCHECK=${SHELLCHECK:-"$(command -v -- shellcheck)"}
if [ ! -f "${SHELLCHECK}" ]; then
echo "error: shellcheck '${SHELLCHECK}' not found."
exit 1
echo "error: shellcheck '${SHELLCHECK}' not found."
exit 1
fi
FILES=$(join -v2 "${IGNORE_FILES_TMP}" "${FOUND_FILES_TMP}")

View File

@ -1,39 +1,21 @@
./test/docsCodeStyle.sh
./test/cmdlineTests.sh
./scripts/isoltest.sh
./scripts/get_version.sh
./scripts/soltest.sh
./scripts/test_emscripten.sh
./scripts/wasm-rebuild/docker-scripts/rebuild_tags.sh
./scripts/wasm-rebuild/docker-scripts/rebuild_current.sh
./scripts/wasm-rebuild/docker-scripts/genbytecode.sh
./scripts/wasm-rebuild/docker-scripts/patch.sh
./scripts/wasm-rebuild/rebuild.sh
./scripts/build_emscripten.sh
./scripts/ci/build_emscripten.sh
./scripts/docker_build.sh
./scripts/docs_version_pragma_check.sh
./scripts/uniqueErrors.sh
./scripts/tests.sh
./scripts/docker_deploy.sh
./scripts/bytecodecompare/storebytecode.sh
./scripts/deps-ppa/static_z3.sh
./scripts/ASTImportTest.sh
./scripts/install_static_z3.sh
./scripts/install_obsolete_jsoncpp_1_7_4.sh
./scripts/install_deps.sh
./scripts/build.sh
./scripts/run_proofs.sh
./scripts/common_cmdline.sh
./scripts/docker_deploy_manual.sh
./scripts/endToEndExtraction/create_traces.sh
./scripts/release.sh
./scripts/download_ossfuzz_corpus.sh
./scripts/release_ppa.sh
./scripts/install_cmake.sh
./scripts/release_emscripten.sh
./scripts/create_source_tarball.sh
./scripts/docs.sh
./.circleci/soltest.sh
./.circleci/osx_install_dependencies.sh
./.circleci/soltest_all.sh

View File

@ -59,13 +59,13 @@ 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 \
-DBoost_USE_STATIC_RUNTIME=1 \
-DTESTS=0 \
-DCMAKE_BUILD_TYPE=Release \
-DBoost_USE_STATIC_LIBS=1 \
-DBoost_USE_STATIC_RUNTIME=1 \
-DTESTS=0 \
..
make soljson
# Patch soljson.js for backwards compatibility.
@ -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`

View File

@ -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

View File

@ -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
@ -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
@ -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)
@ -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

View File

@ -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
@ -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" ]

View File

@ -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"
@ -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
@ -75,7 +75,7 @@ function getAllAvailableVersions()
do
if versionGreater "$listed" "0.4.10"
then
allVersions+=( $listed )
allVersions+=( "$listed" )
fi
done
}
@ -157,7 +157,7 @@ SOLTMPDIR=$(mktemp -d)
# ignore warnings in this case
opts="$opts -o"
findMinimalVersion $f
findMinimalVersion "$f"
if [[ "$version" == "" ]]
then
continue
@ -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

View File

@ -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
@ -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"

View File

@ -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"

View File

@ -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
@ -36,5 +36,5 @@ else
fi
mkdir -p "$PREFIX"
tar xzf "$TMPFILE" -C "$PREFIX" --strip 1
rm $TMPFILE
rm "$TMPFILE"
fi

View File

@ -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
@ -61,7 +61,7 @@ detect_linux_distro() {
else
DISTRO=''
fi
echo $DISTRO
echo "$DISTRO"
}
case $(uname -s) in
@ -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."

View File

@ -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"
@ -13,4 +13,4 @@ TEMPDIR=$(mktemp -d)
make
make install
)
rm -rf $TEMPDIR
rm -rf "$TEMPDIR"

View File

@ -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"

View File

@ -29,17 +29,17 @@
# (c) 2016 solidity contributors.
#------------------------------------------------------------------------------
ZIP_SUFFIX=$1
ZIP_TEMP_DIR=$(pwd)/build/zip/
ZIP_SUFFIX="$1"
ZIP_TEMP_DIR="$(pwd)/build/zip/"
# There is an implicit assumption here that we HAVE to run from root directory.
REPO_ROOT=$(pwd)
mkdir -p $ZIP_TEMP_DIR
mkdir -p "$ZIP_TEMP_DIR"
# Copy all the solidity executables into a temporary directory prior to ZIP creation
cp $REPO_ROOT/build/solc/solc $ZIP_TEMP_DIR
cp "$REPO_ROOT/build/solc/solc" "$ZIP_TEMP_DIR"
# For macOS, we run a fix-up script which alters all of the symbolic links within
# the executables and dynamic libraries such that the ZIP becomes self-contained, by
@ -48,9 +48,9 @@ cp $REPO_ROOT/build/solc/solc $ZIP_TEMP_DIR
# being for kernel-level dylibs.
if [[ "$OSTYPE" == "darwin"* ]]; then
python3 $REPO_ROOT/scripts/fix_homebrew_paths_in_standalone_zip.py $ZIP_TEMP_DIR
python3 "$REPO_ROOT/scripts/fix_homebrew_paths_in_standalone_zip.py" "$ZIP_TEMP_DIR"
fi
# And ZIP it all up, with a filename suffix passed in on the command-line.
mkdir -p $REPO_ROOT/upload
zip -j $REPO_ROOT/upload/solidity-$ZIP_SUFFIX.zip $ZIP_TEMP_DIR/*
mkdir -p "$REPO_ROOT/upload"
zip -j "$REPO_ROOT/upload/solidity-$ZIP_SUFFIX.zip" "$ZIP_TEMP_DIR/"*

View File

@ -67,11 +67,11 @@ fi
for distribution in $DISTRIBUTIONS
do
cd /tmp/
rm -rf $distribution
mkdir $distribution
cd $distribution
rm -rf "$distribution"
mkdir "$distribution"
cd "$distribution"
if [ $distribution = STATIC ]
if [ "$distribution" = STATIC ]
then
pparepo=ethereum-static
SMTDEPENDENCY=""
@ -83,12 +83,12 @@ else
else
pparepo=ethereum-dev
fi
if [ $distribution = focal ]
if [ "$distribution" = focal ]
then
SMTDEPENDENCY="libz3-static-dev,
libcvc4-dev,
"
elif [ $distribution = disco ]
elif [ "$distribution" = disco ]
then
SMTDEPENDENCY="libz3-static-dev,
libcvc4-dev,
@ -112,7 +112,7 @@ wget -O ./solc/deps/downloads/range-v3-0.11.0.tar.gz https://github.com/ericnieb
# Determine version
cd solc
version=$($(dirname "$0")/get_version.sh)
version=$("$(dirname "$0")/get_version.sh")
commithash=$(git rev-parse --short=8 HEAD)
commitdate=$(git show --format=%ci HEAD | head -n 1 | cut - -b1-10 | sed -e 's/-0?/./' | sed -e 's/-0?/./')
@ -128,11 +128,11 @@ fi
# gzip will create different tars all the time and we are not allowed
# to upload the same file twice with different contents, so we only
# create it once.
if [ ! -e /tmp/${packagename}_${debversion}.orig.tar.gz ]
if [ ! -e "/tmp/${packagename}_${debversion}.orig.tar.gz" ]
then
tar --exclude .git -czf /tmp/${packagename}_${debversion}.orig.tar.gz .
tar --exclude .git -czf "/tmp/${packagename}_${debversion}.orig.tar.gz" .
fi
cp /tmp/${packagename}_${debversion}.orig.tar.gz ../
cp "/tmp/${packagename}_${debversion}.orig.tar.gz" ../
# Create debian package information
@ -244,7 +244,7 @@ chmod +x debian/rules
versionsuffix=0ubuntu1~${distribution}
# bump version / add entry to changelog
EMAIL="$email" dch -v 1:${debversion}-${versionsuffix} "git build of ${commithash}"
EMAIL="$email" dch -v "1:${debversion}-${versionsuffix}" "git build of ${commithash}"
# build source package
@ -254,39 +254,39 @@ EMAIL="$email" dch -v 1:${debversion}-${versionsuffix} "git build of ${commithas
debuild -S -d -sa -us -uc
# prepare .changes file for Launchpad
if [ $distribution = STATIC ]
if [ "$distribution" = STATIC ]
then
sed -i -e s/UNRELEASED/${static_build_distribution}/ -e s/urgency=medium/urgency=low/ ../*.changes
sed -i -e "s/UNRELEASED/${static_build_distribution}/" -e s/urgency=medium/urgency=low/ ../*.changes
else
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
fi
# 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_sha1=$(sha1sum $orig | cut -d ' ' -f 1)
orig_sha256=$(sha256sum $orig | cut -d ' ' -f 1)
orig_md5=$(md5sum $orig | cut -d ' ' -f 1)
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)
if wget --quiet -O $orig-tmp "$ppafilesurl/$orig"
if wget --quiet -O "$orig-tmp" "$ppafilesurl/$orig"
then
echo "[WARN] Original tarball found in Ubuntu archive, using it instead"
mv $orig-tmp $orig
mv "$orig-tmp" "$orig"
new_size=$(ls -l *.orig.tar.gz | cut -d ' ' -f 5)
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
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
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

View File

@ -44,7 +44,7 @@ do
BOOST_OPTIONS="${BOOST_OPTIONS} $1"
;;
--help)
usage
usage
exit 0
;;
--run_test | -t )
@ -64,4 +64,4 @@ if [ "$USE_DEBUGGER" -ne "0" ]; then
DEBUG_PREFIX=${DEBUGGER}
fi
exec ${DEBUG_PREFIX} ${SOLIDITY_BUILD_DIR}/test/soltest ${BOOST_OPTIONS} -- --testpath ${REPO_ROOT}/test ${SOLTEST_OPTIONS}
exec ${DEBUG_PREFIX} "${SOLIDITY_BUILD_DIR}/test/soltest" ${BOOST_OPTIONS} -- --testpath "${REPO_ROOT}/test" ${SOLTEST_OPTIONS}

View File

@ -34,7 +34,7 @@ else
BUILD_DIR="$1"
fi
REPO_ROOT=$(cd $(dirname "$0")/.. && pwd)
REPO_ROOT=$(cd "$(dirname "$0")/.." && pwd)
SOLJSON="$REPO_ROOT/$BUILD_DIR/libsolc/soljson.js"
VERSION=$("$REPO_ROOT"/scripts/get_version.sh)

View File

@ -42,7 +42,7 @@ cleanup() {
if [[ -n "$CMDLINE_PID" ]]
then
safe_kill $CMDLINE_PID "Commandline tests"
safe_kill "$CMDLINE_PID" "Commandline tests"
fi
echo "Cleaning up working directory ${WORKDIR} ..."
@ -72,7 +72,7 @@ then
"$REPO_ROOT/test/cmdlineTests.sh" &
CMDLINE_PID=$!
else
if ! $REPO_ROOT/test/cmdlineTests.sh
if ! "$REPO_ROOT/test/cmdlineTests.sh"
then
printError "Commandline tests FAILED"
exit 1
@ -105,7 +105,7 @@ do
then
force_abiv1_flag="--abiencoderv1"
fi
printTask "--> Running tests using "$optimize" --evm-version "$vm" $force_abiv1_flag..."
printTask "--> Running tests using $optimize --evm-version $vm $force_abiv1_flag..."
log=""
if [ -n "$log_directory" ]

View File

@ -1,14 +1,14 @@
#!/bin/sh
REPO=$(dirname $0)/..
REPO="$(dirname "$0")/.."
echo "Finding unique failures..."
(
for x in $*
do
echo -n $x " # "
# This subshell is a workaround to prevent the shell from printing
# "Aborted"
("$REPO"/build/test/tools/solfuzzer < "$x" || true) 2>&1 | head -n 1
echo -n "$x" " # "
# This subshell is a workaround to prevent the shell from printing
# "Aborted"
("$REPO"/build/test/tools/solfuzzer < "$x" || true) 2>&1 | head -n 1
done
) | sort -u -t'#' -k 2

View File

@ -85,8 +85,8 @@ for (var optimize of [false, true])
}
} catch (e) {
console.log(filename + ': FATAL ERROR')
console.error(filename)
console.error(inputs)
console.error(filename)
console.error(inputs)
}
}
}

View File

@ -36,7 +36,7 @@ if [ -d jsoncpp ]; then
set -e
cd jsoncpp
# Checkout the latest commit at the time of our release.
git checkout $(git rev-list -1 --before=$COMMIT_DATE master)
git checkout "$(git rev-list -1 --before="$COMMIT_DATE" master)"
)
fi

View File

@ -43,7 +43,7 @@ function generate_bytecode_report() {
local EXIT_STATUS
if semver -r "<0.4.12" $3 > /dev/null; then
if semver -r "<0.4.12" "$3" > /dev/null; then
set +e
"${SCRIPTDIR}/genbytecode.sh" "$1" >/dev/null 2>&1
EXIT_STATUS=$?
@ -87,7 +87,7 @@ function process_tag() {
cd /src
# Checkout the historic commit instead of the tag directly.
local HISTORIC_COMMIT_HASH="$(grep "${TAG}+" /tmp/release_commit_list.txt | cut -d '+' -f 2 | cut -d '.' -f 2)"
if [ "$(git cat-file -t ${HISTORIC_COMMIT_HASH} 2>/dev/null)" == "commit" ]; then
if [ "$(git cat-file -t "${HISTORIC_COMMIT_HASH}" 2>/dev/null)" == "commit" ]; then
clean_git_checkout "$HISTORIC_COMMIT_HASH"
else
clean_git_checkout "${TAG}"
@ -138,11 +138,11 @@ function process_tag() {
if [ -f "${OUTPUTDIR}/bin/soljson-${FULL_VERSION_SUFFIX}.js" ]; then
echo -ne "GENERATE BYTECODE REPORT FOR ${CYAN}${TAG}${RESET}... "
generate_bytecode_report "${OUTPUTDIR}/bin/soljson-${FULL_VERSION_SUFFIX}.js" "${OUTPUTDIR}"/log/reports/report-${TAG}.txt "${TAG}"
generate_bytecode_report "${OUTPUTDIR}/bin/soljson-${FULL_VERSION_SUFFIX}.js" "${OUTPUTDIR}/log/reports/report-${TAG}.txt" "${TAG}"
echo -ne "GENERATE BYTECODE REPORT FOR HISTORIC ${CYAN}${TAG}${RESET}... "
rm -rf /tmp/soljson.js
if wget -q "$RELEASE_URL/soljson-${HISTORIC_VERSION_SUFFIX}.js" -O /tmp/soljson.js; then
generate_bytecode_report /tmp/soljson.js "${OUTPUTDIR}"/log/reports/report-historic-${TAG}.txt "${TAG}"
generate_bytecode_report /tmp/soljson.js "${OUTPUTDIR}/log/reports/report-historic-${TAG}.txt" "${TAG}"
else
echo -e "${ORANGE}CANNOT FETCH RELEASE${RESET}"
fi

View File

@ -25,4 +25,4 @@ if [ ! -d "${OUTPUTDIR}" ]; then
fi
OUTPUTDIR=$(realpath "${OUTPUTDIR}")
docker run --rm -v "${OUTPUTDIR}":/tmp/output -v "${SCRIPTDIR}":/tmp/scripts:ro -it trzeci/emscripten:sdk-tag-1.39.3-64bit /tmp/scripts/docker-scripts/rebuild_tags.sh "${TAGS}" /tmp/output $@
docker run --rm -v "${OUTPUTDIR}":/tmp/output -v "${SCRIPTDIR}":/tmp/scripts:ro -it trzeci/emscripten:sdk-tag-1.39.3-64bit /tmp/scripts/docker-scripts/rebuild_tags.sh "${TAGS}" /tmp/output "$@"

View File

@ -30,7 +30,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"
@ -185,13 +185,13 @@ function test_solc_behaviour()
[[ $exit_code_expectation_file == "" ]] && exit 1
fi
if [[ "$(cat $stdout_path)" != "${stdout_expected}" ]]
if [[ "$(cat "$stdout_path")" != "${stdout_expected}" ]]
then
printError "Incorrect output on stdout received. Expected:"
echo -e "${stdout_expected}"
printError "But got:"
echo -e "$(cat $stdout_path)"
echo -e "$(cat "$stdout_path")"
printError "When running $solc_command"
@ -199,13 +199,13 @@ function test_solc_behaviour()
[[ $stdout_expectation_file == "" ]] && exit 1
fi
if [[ "$(cat $stderr_path)" != "${stderr_expected}" ]]
if [[ "$(cat "$stderr_path")" != "${stderr_expected}" ]]
then
printError "Incorrect output on stderr received. Expected:"
echo -e "${stderr_expected}"
printError "But got:"
echo -e "$(cat $stderr_path)"
echo -e "$(cat "$stderr_path")"
printError "When running $solc_command"
@ -223,14 +223,14 @@ function test_solc_assembly_output()
local expected="${2}"
local solc_args="${3}"
local expected_object="object \"object\" { code "${expected}" }"
local expected_object="object \"object\" { code ${expected} }"
output=$(echo "${input}" | "$SOLC" - ${solc_args} 2>/dev/null)
empty=$(echo "$output" | tr '\n' ' ' | tr -s ' ' | sed -ne "/${expected_object}/p")
if [ -z "$empty" ]
then
printError "Incorrect assembly output. Expected: "
echo -e ${expected}
echo -e "${expected}"
printError "with arguments ${solc_args}, but got:"
echo "${output}"
exit 1
@ -279,8 +279,8 @@ printTask "Running general commandline tests..."
# Strip trailing slash from $tdir.
tdir=$(basename "${tdir}")
inputFiles="$(ls -1 ${tdir}/input.* 2> /dev/null || true)"
inputCount="$(echo ${inputFiles} | wc -w)"
inputFiles="$(ls -1 "${tdir}/input."* 2> /dev/null || true)"
inputCount="$(echo "${inputFiles}" | wc -w)"
if (( ${inputCount} > 1 ))
then
printError "Ambiguous input. Found input files in multiple formats:"
@ -300,18 +300,18 @@ printTask "Running general commandline tests..."
then
stdin="${inputFile}"
inputFile=""
stdout="$(cat ${tdir}/output.json 2>/dev/null || true)"
stdout="$(cat "${tdir}/output.json" 2>/dev/null || true)"
stdoutExpectationFile="${tdir}/output.json"
args="--standard-json "$(cat ${tdir}/args 2>/dev/null || true)
args="--standard-json "$(cat "${tdir}/args" 2>/dev/null || true)
else
stdin=""
stdout="$(cat ${tdir}/output 2>/dev/null || true)"
stdout="$(cat "${tdir}/output" 2>/dev/null || true)"
stdoutExpectationFile="${tdir}/output"
args=$(cat ${tdir}/args 2>/dev/null || true)
args=$(cat "${tdir}/args" 2>/dev/null || true)
fi
exitCodeExpectationFile="${tdir}/exit"
exitCode=$(cat "$exitCodeExpectationFile" 2>/dev/null || true)
err="$(cat ${tdir}/err 2>/dev/null || true)"
err="$(cat "${tdir}/err" 2>/dev/null || true)"
stderrExpectationFile="${tdir}/err"
test_solc_behaviour "$inputFile" \
"$args" \
@ -444,7 +444,7 @@ SOLTMPDIR=$(mktemp -d)
set -e
# This should fail
if [[ !("$output" =~ "No input files given") || ($result == 0) ]]
if [[ ! ("$output" =~ "No input files given") || ($result == 0) ]]
then
printError "Incorrect response to empty input arg list: $output"
exit 1
@ -478,7 +478,7 @@ printTask "Testing AST import..."
SOLTMPDIR=$(mktemp -d)
(
cd "$SOLTMPDIR"
$REPO_ROOT/scripts/ASTImportTest.sh
"$REPO_ROOT/scripts/ASTImportTest.sh"
if [ $? -ne 0 ]
then
rm -rf "$SOLTMPDIR"

View File

@ -4,7 +4,7 @@ set -e
## GLOBAL VARIABLES
REPO_ROOT=$(cd $(dirname "$0")/.. && pwd)
REPO_ROOT=$(cd "$(dirname "$0")/.." && pwd)
## FUNCTIONS