diff --git a/.github/travis_build.sh b/.github/travis_build.sh index 6b2fae8a..2e63a97f 100644 --- a/.github/travis_build.sh +++ b/.github/travis_build.sh @@ -5,16 +5,16 @@ set -e; set -o pipefail # Copyright (C) Markus Franz Xaver Johannes Oberhumer if [[ $TRAVIS_OS_NAME == osx ]]; then -argv0=$0; argv0abs=$(greadlink -en -- "$0"); argv0dir=$(dirname "$argv0abs") + argv0=$0; argv0abs=$(greadlink -en -- "$0"); argv0dir=$(dirname "$argv0abs") else -argv0=$0; argv0abs=$(readlink -en -- "$0"); argv0dir=$(dirname "$argv0abs") + argv0=$0; argv0abs=$(readlink -en -- "$0"); argv0dir=$(dirname "$argv0abs") fi source "$argv0dir/travis_init.sh" || exit 1 # create dirs cd / || exit 1 mkbuilddirs $upx_BUILDDIR $ucl_BUILDDIR $upx_testsuite_BUILDDIR $zlib_BUILDDIR -cd / && cd $upx_SRCDIR || exit 1 +cd / && cd "$upx_SRCDIR" || exit 1 echo print_settings @@ -25,10 +25,10 @@ echo # check whitespace if [[ $TRAVIS_OS_NAME == linux ]]; then -cd / && cd $upx_SRCDIR || exit 1 -echo "Checking source code for whitespace violations..." -bash ./src/stub/scripts/check_whitespace.sh || exit 1 -echo " Passed." + cd / && cd $upx_SRCDIR || exit 1 + echo "Checking source code for whitespace violations..." + bash ./src/stub/scripts/check_whitespace.sh || exit 1 + echo " Passed." fi # linux set -x @@ -45,7 +45,7 @@ if [[ $BM_X =~ (^|\+)rebuild-stubs($|\+) ]]; then else bin_upx=$(readlink -en -- "$upx_SRCDIR/../deps/bin-upx-20210104") fi - cd / && cd $upx_SRCDIR || exit 1 + cd / && cd "$upx_SRCDIR" || exit 1 extra_subdirs=() extra_subdirs+=( src/stub/src/arch/amd64 ) extra_subdirs+=( src/stub/src/arch/arm/v4a ) @@ -92,7 +92,7 @@ fi # build UCL # -cd / && cd $ucl_BUILDDIR || exit 1 +cd / && cd "$ucl_BUILDDIR" || exit 1 # patch UCL sed 's/^#elif (ACC_ARCH_AMD64 || ACC_ARCH_IA64)$/& \&\& !defined(__ILP32__)/' $ucl_SRCDIR/acc/acc_chk.ch > a.tmp if cmp -s a.tmp $ucl_SRCDIR/acc/acc_chk.ch; then rm a.tmp; else mv a.tmp $ucl_SRCDIR/acc/acc_chk.ch; fi @@ -115,7 +115,7 @@ fi # if [[ $BUILD_LOCAL_ZLIB == 1 ]]; then - cd / && cd $zlib_BUILDDIR || exit 1 + cd / && cd "$zlib_BUILDDIR" || exit 1 # build manually rm -f ./*.o libz.a $CC -O2 -c $zlib_SRCDIR/*.c @@ -127,7 +127,7 @@ fi # export UPX_UCLDIR="$ucl_SRCDIR" -cd / && cd $upx_BUILDDIR || exit 1 +cd / && cd "$upx_BUILDDIR" || exit 1 make="make -f $upx_SRCDIR/src/Makefile" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L$ucl_BUILDDIR/src/.libs" if [[ $BUILD_LOCAL_ZLIB == 1 ]]; then diff --git a/.github/travis_deploy.sh b/.github/travis_deploy.sh index 62e59dda..f0b51fdc 100644 --- a/.github/travis_deploy.sh +++ b/.github/travis_deploy.sh @@ -5,9 +5,9 @@ set -e; set -o pipefail # Copyright (C) Markus Franz Xaver Johannes Oberhumer if [[ $TRAVIS_OS_NAME == osx ]]; then -argv0=$0; argv0abs=$(greadlink -en -- "$0"); argv0dir=$(dirname "$argv0abs") + argv0=$0; argv0abs=$(greadlink -en -- "$0"); argv0dir=$(dirname "$argv0abs") else -argv0=$0; argv0abs=$(readlink -en -- "$0"); argv0dir=$(dirname "$argv0abs") + argv0=$0; argv0abs=$(readlink -en -- "$0"); argv0dir=$(dirname "$argv0abs") fi source "$argv0dir/travis_init.sh" || exit 1 @@ -32,7 +32,7 @@ elif [[ -n $GITLAB_CI ]]; then branch=$CI_BUILD_REF_NAME else branch=$TRAVIS_BRANCH - if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then exit 0; fi + if [[ $TRAVIS_PULL_REQUEST != "false" ]]; then exit 0; fi fi subdir=${subdir%%:*}; subdir=${subdir%%/*}; subdir=${subdir%%--*} case $branch in @@ -45,9 +45,9 @@ case $branch in esac # get $rev, $branch and $git_user -cd / && cd $upx_SRCDIR || exit 1 +cd / && cd "$upx_SRCDIR" || exit 1 rev=$(git rev-parse --verify HEAD) -if [[ "$branch" == gitlab* ]]; then +if [[ $branch == gitlab* ]]; then if git fetch -v origin devel; then git branch -a -v rev=$(git merge-base origin/devel $rev || echo $rev) @@ -74,7 +74,7 @@ unset timestamp date # // prepare directory $d # ************************************************************************/ -cd / && cd $upx_BUILDDIR || exit 1 +cd / && cd "$upx_BUILDDIR" || exit 1 mkdir deploy || exit 1 chmod 700 deploy @@ -105,10 +105,10 @@ d=$d-$BM_C-$BM_B # remove redundant -m32/-m64/-x86/-x64 from directory name if [[ $d =~ ^((i386-darwin|i386-linux|i386-win32).*)(-m32|-x86)(-.+)?$ ]]; then - d="${BASH_REMATCH[1]}${BASH_REMATCH[4]}" + d="${BASH_REMATCH[1]}${BASH_REMATCH[4]}" fi if [[ $d =~ ^((amd64-darwin|amd64-linux|amd64-win64).*)(-m64|-x64)(-.+)?$ ]]; then - d="${BASH_REMATCH[1]}${BASH_REMATCH[4]}" + d="${BASH_REMATCH[1]}${BASH_REMATCH[4]}" fi if [[ -n $subdir ]]; then diff --git a/.github/travis_init.sh b/.github/travis_init.sh index 8f37fc6e..4347f9a7 100644 --- a/.github/travis_init.sh +++ b/.github/travis_init.sh @@ -140,7 +140,7 @@ if [[ -n $BM_CROSS ]]; then esac fi fi # BM_CROSS -if [[ "$CC" == "false" ]]; then # generic +if [[ $CC == "false" ]]; then # generic if [[ -z $BM_CROSS ]]; then if [[ $TRAVIS_OS_NAME == osx ]]; then case $BM_C in @@ -199,7 +199,7 @@ mkbuilddirs() { } # search for an existing $toptop_builddir if [[ -z $toptop_builddir ]]; then - for d in . ..; do + for d in . ..; do for subdir in "local" appveyor circle github gitlab travis .; do dd=$d/build/$subdir if [[ -d $dd ]]; then diff --git a/.github/travis_testsuite_1.sh b/.github/travis_testsuite_1.sh index e45f0345..f5dfbe80 100644 --- a/.github/travis_testsuite_1.sh +++ b/.github/travis_testsuite_1.sh @@ -9,9 +9,9 @@ set -e; set -o pipefail # if [[ $TRAVIS_OS_NAME == osx ]]; then -argv0=$0; argv0abs=$(greadlink -en -- "$0"); argv0dir=$(dirname "$argv0abs") + argv0=$0; argv0abs=$(greadlink -en -- "$0"); argv0dir=$(dirname "$argv0abs") else -argv0=$0; argv0abs=$(readlink -en -- "$0"); argv0dir=$(dirname "$argv0abs") + argv0=$0; argv0abs=$(readlink -en -- "$0"); argv0dir=$(dirname "$argv0abs") fi source "$argv0dir/travis_init.sh" || exit 1 @@ -27,7 +27,7 @@ fi # create dirs cd / || exit 1 mkbuilddirs $upx_testsuite_BUILDDIR -cd / && cd $upx_testsuite_BUILDDIR || exit 1 +cd / && cd "$upx_testsuite_BUILDDIR" || exit 1 if [[ ! -d $upx_testsuite_SRCDIR/files/packed ]]; then exit 1; fi # /*********************************************************************** @@ -43,7 +43,7 @@ testsuite_split_f() { fb=$(basename "$1") fsubdir=$(basename "$fd") # sanity checks - if [[ ! -f "$1" || -z "$fsubdir" || -z "$fb" ]]; then + if [[ ! -f $1 || -z $fsubdir || -z $fb ]]; then fd= fb= fsubdir= fi } @@ -111,7 +111,7 @@ testsuite_run_compress() { # ************************************************************************/ recreate_expected_sha256sums() { - local o="$1" + local o=$1 local files f d echo "########## begin .sha256sums.recreate" > "$o" files=*/.sha256sums.current @@ -163,7 +163,7 @@ if [[ $BM_T =~ (^|\+)valgrind($|\+) ]]; then fi if [[ $BM_B =~ (^|\+)coverage($|\+) ]]; then - (cd / && cd $upx_BUILDDIR && lcov -d . --zerocounters) + (cd / && cd "$upx_BUILDDIR" && lcov -d . --zerocounters) fi export UPX="--prefer-ucl --no-color --no-progress" @@ -194,7 +194,6 @@ for f in $upx_testsuite_SRCDIR/files/packed/*/upx-3.9[15]*; do done testsuite_check_sha $testdir - # run one pack+unpack step to canonicalize the files testdir=t020_canonicalized mkdir $testdir; v=expected_sha256sums__$testdir; echo -n "${!v}" >$testdir/.sha256sums.expected @@ -248,7 +247,7 @@ time testsuite_run_compress --all-methods --no-lzma -5 --no-filter # // summary # ************************************************************************/ -# recreate checkums from current version for an easy update in case of changes +# recreate checksums from current version for an easy update in case of changes recreate_expected_sha256sums .sha256sums.recreate testsuite_header "UPX testsuite summary" @@ -258,10 +257,10 @@ if ! $upx_run --version; then fi echo echo "upx_exe='$upx_exe'" -if [[ "$upx_run" != "$upx_exe" ]]; then +if [[ $upx_run != "$upx_exe" ]]; then echo "upx_run='$upx_run'" fi -if [[ -f "$upx_exe" ]]; then +if [[ -f $upx_exe ]]; then ls -l "$upx_exe" file "$upx_exe" || true fi