From a39abe3abe03f299c5149b70b87cf07aca7e7013 Mon Sep 17 00:00:00 2001 From: Alexei Pastuchov Date: Tue, 25 Jul 2017 11:57:22 +0200 Subject: [PATCH 01/17] SC2145 fixing --- bootstrap.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index 891374e24..ce84e8e51 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -58,9 +58,9 @@ use_banner () command_not_found_handle () { - warn "$@: command not found" + warn "$*" ": command not found" - #if $DEBUG; then + #if $DEBUG; then echo "" echo "Stack trace:" local frame=0 @@ -74,19 +74,19 @@ command_not_found_handle () } error () -{ - echo "$BASH_SOURCE:$BASH_LINENO: $@" >&2 +{ + echo "$BASH_SOURCE:$BASH_LINENO: " "$*" >&2 } die () -{ - echo "$BASH_SOURCE:$BASH_LINENO: $@" >&2 - exit 1; +{ + echo "$BASH_SOURCE:$BASH_LINENO: " "$*" >&2 + exit 1; } warn () -{ - echo "$BASH_SOURCE:$BASH_LINENO: $@" +{ + echo "$BASH_SOURCE:$BASH_LINENO: " "$*" #echo "$BASH_SOURCE:$BASH_LINENO: $@" >&1 } @@ -1109,7 +1109,7 @@ run_autoreconf () run () { if $verbose; then - echo "\`$@' $ARGS" + echo "\`$*'" "$ARGS" fi if [ -z "$1" ]; then From 31c8fab078ff7c3db225bb6a5bb54774df91ae88 Mon Sep 17 00:00:00 2001 From: Alexei Pastuchov Date: Tue, 25 Jul 2017 13:15:44 +0200 Subject: [PATCH 02/17] SC2155 fixing --- bootstrap.sh | 72 ++++++++++++++++++++++++++++++++-------------------- 1 file changed, 44 insertions(+), 28 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index ce84e8e51..45b922b81 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -93,7 +93,8 @@ warn () nassert () { local param_name=\$"$1" - local param_value="$(eval "expr \"$param_name\" ")" + local param_value + param_value="$(eval "expr \"$param_name\" ")" if [ -n "$param_value" ]; then echo "$bash_source:$bash_lineno: assert($param_name) had value of "$param_value"" >&2 @@ -104,7 +105,8 @@ nassert () assert () { local param_name=\$"$1" - local param_value="$(eval "expr \"$param_name\" ")" + local param_value + param_value="$(eval "expr \"$param_name\" ")" if [ -z "$param_value" ]; then echo "$bash_source:$bash_lineno: assert($param_name)" >&2 @@ -168,7 +170,8 @@ rebuild_host_os () # values: darwin,fedora,rhel,ubuntu,debian,opensuse set_VENDOR_DISTRIBUTION () { - local dist="$(echo "$1" | tr '[:upper:]' '[:lower:]')" + local dist + dist="$(echo "$1" | tr '[:upper:]' '[:lower:]')" case "$dist" in darwin) VENDOR_DISTRIBUTION='darwin' @@ -200,7 +203,8 @@ set_VENDOR_DISTRIBUTION () # Validate a Vendor's release name/number set_VENDOR_RELEASE () { - local release="$(echo "$1" | tr '[:upper:]' '[:lower:]')" + local release + release="$(echo "$1" | tr '[:upper:]' '[:lower:]')" if $verbose; then echo "VENDOR_DISTRIBUTION:$VENDOR_DISTRIBUTION" @@ -275,7 +279,8 @@ set_VENDOR_RELEASE () # Valid values are: apple, redhat, centos, canonical, oracle, suse set_VENDOR () { - local vendor="$(echo "$1" | tr '[:upper:]' '[:lower:]')" + local vendor + vendor="$(echo "$1" | tr '[:upper:]' '[:lower:]')" case $vendor in apple) @@ -347,33 +352,42 @@ determine_target_platform () UNAME_KERNEL="$(uname -s 2>/dev/null)" || UNAME_SYSTEM=unknown UNAME_KERNEL_RELEASE="$(uname -r 2>/dev/null)" || UNAME_KERNEL_RELEASE=unknown - if [[ -x '/usr/bin/sw_vers' ]]; then - local _VERSION="$(/usr/bin/sw_vers -productVersion)" - set_VENDOR 'apple' 'darwin' $_VERSION + if [[ -x '/usr/bin/sw_vers' ]]; then + local _VERSION + _VERSION="$(/usr/bin/sw_vers -productVersion)" + set_VENDOR 'apple' 'darwin' "$_VERSION" elif [[ $(uname) == 'Darwin' ]]; then set_VENDOR 'apple' 'darwin' 'mountain' - elif [[ -f '/etc/fedora-release' ]]; then - local fedora_version="$(awk ' { print $3 } ' < /etc/fedora-release)" - set_VENDOR 'redhat' 'fedora' $fedora_version + elif [[ -f '/etc/fedora-release' ]]; then + local fedora_version + fedora_version="$(awk ' { print $3 } ' < /etc/fedora-release)" + set_VENDOR 'redhat' 'fedora' "$fedora_version" elif [[ -f '/etc/centos-release' ]]; then - local centos_version="$(awk ' { print $7 } ' < /etc/centos-release)" - set_VENDOR 'centos' 'rhel' $centos_version + local centos_version + centos_version="$(awk ' { print $7 } ' < /etc/centos-release)" + set_VENDOR 'centos' 'rhel' "$centos_version" elif [[ -f '/etc/SuSE-release' ]]; then - local suse_distribution="$(head -1 /etc/SuSE-release | awk ' { print $1 } ')" - local suse_version="$(head -1 /etc/SuSE-release | awk ' { print $2 } ')" - set_VENDOR 'suse' $suse_distribution $suse_version + local suse_distribution + suse_distribution="$(head -1 /etc/SuSE-release | awk ' { print $1 } ')" + local suse_version + suse_version="$(head -1 /etc/SuSE-release | awk ' { print $2 } ')" + set_VENDOR 'suse' "$suse_distribution" "$suse_version" elif [[ -f '/etc/redhat-release' ]]; then - local rhel_version="$(awk ' { print $7 } ' < /etc/redhat-release)" - local _vendor="$(rpm -qf /etc/redhat-release)" - set_VENDOR $_vendor 'rhel' $rhel_version - elif [[ -f '/etc/os-release' ]]; then + local rhel_version + rhel_version="$(awk ' { print $7 } ' < /etc/redhat-release)" + local _vendor + _vendor="$(rpm -qf /etc/redhat-release)" + set_VENDOR "$_vendor" 'rhel' "$rhel_version" + elif [[ -f '/etc/os-release' ]]; then source '/etc/os-release' - set_VENDOR $ID $ID $VERSION_ID - elif [[ -x '/usr/bin/lsb_release' ]]; then - local _ID="$(/usr/bin/lsb_release -s -i)" - local _VERSION="$(/usr/bin/lsb_release -s -r)" - set_VENDOR $_ID $_ID $_VERSION_ID - elif [[ -f '/etc/lsb-release' ]]; then + set_VENDOR "$ID" "$ID" "$VERSION_ID" + elif [[ -x '/usr/bin/lsb_release' ]]; then + local _ID + _ID="$(/usr/bin/lsb_release -s -i)" + local _VERSION + _VERSION="$(/usr/bin/lsb_release -s -r)" + set_VENDOR "$_ID" "$_ID" "$_VERSION_ID" + elif [[ -f '/etc/lsb-release' ]]; then source '/etc/lsb-release' set_VENDOR 'canonical' $DISTRIB_ID $DISTRIB_CODENAME fi @@ -587,7 +601,8 @@ make_valgrind () make_install_system () { - local INSTALL_LOCATION="$(mktemp -d /tmp/XXXXXXXXXX)" + local INSTALL_LOCATION + INSTALL_LOCATION="$(mktemp -d /tmp/XXXXXXXXXX)" save_BUILD PREFIX_ARG="--prefix=$INSTALL_LOCATION" @@ -1798,7 +1813,8 @@ merge () enable_debug () { if ! $debug; then - local caller_loc="$(caller)" + local caller_loc + caller_loc="$(caller)" if [[ -n "$1" ]]; then echo "$caller_loc Enabling debug: $1" else From b00453cacd3cd16c34aaf8a94d187eed0aeb12a6 Mon Sep 17 00:00:00 2001 From: Alexei Pastuchov Date: Tue, 25 Jul 2017 13:19:27 +0200 Subject: [PATCH 03/17] SC2154 fixing --- bootstrap.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index 45b922b81..ef0305fda 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -97,7 +97,7 @@ nassert () param_value="$(eval "expr \"$param_name\" ")" if [ -n "$param_value" ]; then - echo "$bash_source:$bash_lineno: assert($param_name) had value of "$param_value"" >&2 + echo "$BASH_SOURCE:$BASH_LINENO: assert($param_name) had value of $param_value" >&2 exit 1 fi } @@ -109,7 +109,7 @@ assert () param_value="$(eval "expr \"$param_name\" ")" if [ -z "$param_value" ]; then - echo "$bash_source:$bash_lineno: assert($param_name)" >&2 + echo "$BASH_SOURCE:$BASH_LINENO: assert($param_name)" >&2 exit 1 fi } From 29267d4f105114400f5c192160b0f8a3cc21ed31 Mon Sep 17 00:00:00 2001 From: Alexei Pastuchov Date: Tue, 25 Jul 2017 13:24:37 +0200 Subject: [PATCH 04/17] SC2086 fixing --- bootstrap.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index ef0305fda..1efa48231 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -236,7 +236,7 @@ set_VENDOR_RELEASE () VENDOR_RELEASE='mavericks' ;; *) - echo $release + echo "$release" VENDOR_RELEASE='unknown' ;; esac @@ -389,7 +389,7 @@ determine_target_platform () set_VENDOR "$_ID" "$_ID" "$_VERSION_ID" elif [[ -f '/etc/lsb-release' ]]; then source '/etc/lsb-release' - set_VENDOR 'canonical' $DISTRIB_ID $DISTRIB_CODENAME + set_VENDOR 'canonical' "$DISTRIB_ID" "$DISTRIB_CODENAME" fi rebuild_host_os @@ -444,11 +444,11 @@ run_configure () case $HOST_OS in rhel-5*) command_exists 'gcc44' || die "Could not locate gcc44" - run CC=gcc44 CXX=gcc44 $top_srcdir/configure "$BUILD_CONFIGURE_ARG" || die "Cannot execute CC=gcc44 CXX=gcc44 configure $BUILD_CONFIGURE_ARG" + run CC=gcc44 CXX=gcc44 "$top_srcdir/configure" "$BUILD_CONFIGURE_ARG" || die "Cannot execute CC=gcc44 CXX=gcc44 configure $BUILD_CONFIGURE_ARG" ret=$? ;; *) - run $CONFIGURE "$BUILD_CONFIGURE_ARG" + run "$CONFIGURE" "$BUILD_CONFIGURE_ARG" ret=$? ;; esac @@ -619,7 +619,7 @@ make_install_system () make_target 'uninstall' - rm -r -f $INSTALL_LOCATION + rm -r -f "$INSTALL_LOCATION" make 'distclean' if [ -f 'Makefile' ]; then @@ -1108,7 +1108,7 @@ run_autoreconf () fi if $use_libtool; then - assert $BOOTSTRAP_LIBTOOLIZE + assert "$BOOTSTRAP_LIBTOOLIZE" if $jenkins_build_environment; then run "$BOOTSTRAP_LIBTOOLIZE" '--copy' '--install' || die "Cannot execute $BOOTSTRAP_LIBTOOLIZE" else @@ -1279,7 +1279,7 @@ autoreconf_setup () if $use_libtool; then if [[ -n "$LIBTOOLIZE" ]]; then - BOOTSTRAP_LIBTOOLIZE="$(type -p $LIBTOOLIZE)" + BOOTSTRAP_LIBTOOLIZE=$(type -p "$LIBTOOLIZE") if [[ -z "$BOOTSTRAP_LIBTOOLIZE" ]]; then echo "Couldn't find user supplied libtoolize, it is required" @@ -1573,7 +1573,7 @@ execute_job () do # If we are running inside of Jenkins, we want to only run some of the possible tests if $jenkins_build_environment; then - check_make_target $target + check_make_target "$target" ret=$? if [ $ret -ne 0 ]; then warn "Unknown BOOTSTRAP_TARGET option: $target" @@ -1800,7 +1800,7 @@ merge () if [[ "$VCS_CHECKOUT" == 'bzr' ]]; then if test -n "$BRANCH_TO_MERGE"; then - bzr merge $BRANCH_TO_MERGE + bzr merge "$BRANCH_TO_MERGE" bzr commit --message="Merge $BRANCH_TO_MERGE Build: $BUILD_TAG" --unchanged fi From 67548034e5d7c938d3640dfc7528c87e0dac78a4 Mon Sep 17 00:00:00 2001 From: Alexei Pastuchov Date: Tue, 25 Jul 2017 13:27:07 +0200 Subject: [PATCH 05/17] SC2129 fixing --- bootstrap.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index 1efa48231..67e7d0e20 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -466,11 +466,14 @@ setup_gdb_command () { GDB_TMPFILE=$(mktemp /tmp/gdb.XXXXXXXXXX) echo 'set logging overwrite on' > "$GDB_TMPFILE" - echo 'set logging on' >> "$GDB_TMPFILE" - echo 'set environment LIBTEST_IN_GDB=1' >> "$GDB_TMPFILE" - echo 'run' >> "$GDB_TMPFILE" - echo 'thread apply all bt' >> "$GDB_TMPFILE" - echo 'quit' >> "$GDB_TMPFILE" + { + echo 'set logging on' + echo 'set environment LIBTEST_IN_GDB=1' + echo 'run' + echo 'thread apply all bt' + echo 'quit' + } >> "$GDB_TMPFILE" + GDB_COMMAND="gdb -f -batch -x $GDB_TMPFILE" } From 349c6909760ac628246380624c1338a56858a536 Mon Sep 17 00:00:00 2001 From: Alexei Pastuchov Date: Tue, 25 Jul 2017 13:35:02 +0200 Subject: [PATCH 06/17] SC2034 fixing --- bootstrap.sh | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index 67e7d0e20..5584da892 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -349,7 +349,7 @@ set_VENDOR () determine_target_platform () { UNAME_MACHINE_ARCH="$(uname -m 2>/dev/null)" || UNAME_MACHINE_ARCH=unknown - UNAME_KERNEL="$(uname -s 2>/dev/null)" || UNAME_SYSTEM=unknown + UNAME_KERNEL="$(uname -s 2>/dev/null)" || UNAME_KERNEL=unknown UNAME_KERNEL_RELEASE="$(uname -r 2>/dev/null)" || UNAME_KERNEL_RELEASE=unknown if [[ -x '/usr/bin/sw_vers' ]]; then @@ -817,6 +817,7 @@ make_for_clang_analyzer () export CC CXX CONFIGURE='scan-build ./configure' CONFIGURE_ARGS='--enable-debug' + export CONFIGURE_ARGS run_configure @@ -1588,7 +1589,6 @@ execute_job () use_banner $target fi - local snapshot_run=false local valgrind_run=false case $target in @@ -1647,7 +1647,6 @@ execute_job () ;; 'snapshot') make_for_snapshot - snapshot_run=true check_snapshot ;; 'rpm') @@ -1713,10 +1712,6 @@ main () local OLD_MAKE= local OLD_LOG_COMPILER= - # If we call autoreconf on the platform or not - local AUTORECONF_REBUILD_HOST=false - local AUTORECONF_REBUILD=false - local -r top_srcdir="$(pwd)" # Default configure From 207cff472550a2946c1d8fee74fa8b10ffe69c0a Mon Sep 17 00:00:00 2001 From: Alexei Pastuchov Date: Tue, 25 Jul 2017 13:36:33 +0200 Subject: [PATCH 07/17] SC2124 fixing --- bootstrap.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap.sh b/bootstrap.sh index 5584da892..59a30324f 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -1203,7 +1203,7 @@ parse_command_line_options () shift $((OPTIND-1)) if [ -n "$1" ]; then - OPT_TARGET="$@" + OPT_TARGET="$*" fi } From 9ffd165fce80657cb990eef04f7d709647bf7743 Mon Sep 17 00:00:00 2001 From: Alexei Pastuchov Date: Tue, 25 Jul 2017 13:43:26 +0200 Subject: [PATCH 08/17] SC2034 fixing --- bootstrap.sh | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index 59a30324f..0756ca28a 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -323,27 +323,6 @@ set_VENDOR () set_VENDOR_DISTRIBUTION "$2" set_VENDOR_RELEASE "$3" - - # Set which vendor/versions we trust for autoreconf - case $VENDOR_DISTRIBUTION in - fedora) - if [[ "x$VENDOR_RELEASE" == 'x18' ]]; then - AUTORECONF_REBUILD_HOST=true - elif [[ "x$VENDOR_RELEASE" == 'xsphericalcow' ]]; then - AUTORECONF_REBUILD_HOST=true - elif [[ "x$VENDOR_RELEASE" == 'x19' ]]; then - AUTORECONF_REBUILD_HOST=true - fi - ;; - canonical) - if [[ "x$VENDOR_RELEASE" == 'xprecise' ]]; then - AUTORECONF_REBUILD_HOST=true - elif [[ "x$VENDOR_RELEASE" == 'xquantal' ]]; then - AUTORECONF_REBUILD_HOST=true - fi - ;; - esac - } determine_target_platform () From 807843a729e4c59053b3be4c7d5b1771ab6a5266 Mon Sep 17 00:00:00 2001 From: Alexei Pastuchov Date: Tue, 25 Jul 2017 13:49:09 +0200 Subject: [PATCH 09/17] SC2119 fixing --- bootstrap.sh | 6 ------ 1 file changed, 6 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index 0756ca28a..782ddc1c5 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -388,12 +388,6 @@ run_configure () die "$CONFIGURE does not exist" fi - local BUILD_DIR="$1" - if [[ -n "$BUILD_DIR" ]]; then - rm -r -f $BUILD_DIR - mkdir -p $BUILD_DIR - fi - # Arguments for configure local BUILD_CONFIGURE_ARG='' From 3d5d7577793fc14279eccc2db77b0f1f3d91d6a1 Mon Sep 17 00:00:00 2001 From: Alexei Pastuchov Date: Tue, 25 Jul 2017 13:52:01 +0200 Subject: [PATCH 10/17] SC2086 fixing --- bootstrap.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index 782ddc1c5..fc57c87ca 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -583,7 +583,7 @@ make_install_system () save_BUILD PREFIX_ARG="--prefix=$INSTALL_LOCATION" - if [ ! -d $INSTALL_LOCATION ] ; then + if [ ! -d "$INSTALL_LOCATION" ] ; then die "ASSERT temp directory not found '$INSTALL_LOCATION'" fi @@ -1520,10 +1520,10 @@ execute_job () return 1 fi - if $print_setup_opt -o $debug; then - echo + if $print_setup_opt -o "$debug"; then + echo print_setup - echo + echo # Exit if all we were looking for were the currently used options if $print_setup_opt; then From e72f11e880faa02dea9d497999a79e7ad8c8a3fc Mon Sep 17 00:00:00 2001 From: Alexei Pastuchov Date: Tue, 25 Jul 2017 13:54:13 +0200 Subject: [PATCH 11/17] rm trailing spaces --- bootstrap.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index fc57c87ca..b8d6f55d8 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -206,7 +206,7 @@ set_VENDOR_RELEASE () local release release="$(echo "$1" | tr '[:upper:]' '[:lower:]')" - if $verbose; then + if $verbose; then echo "VENDOR_DISTRIBUTION:$VENDOR_DISTRIBUTION" echo "VENDOR_RELEASE:$release" fi @@ -389,7 +389,7 @@ run_configure () fi # Arguments for configure - local BUILD_CONFIGURE_ARG='' + local BUILD_CONFIGURE_ARG='' # If debug is set we enable both debug and asssert, otherwise we see if this is a VCS checkout and if so enable assert # Set ENV ASSERT in order to enable assert. From 96a7cb0954b407916e56e8e53c839d66f7d294c9 Mon Sep 17 00:00:00 2001 From: Alexei Pastuchov Date: Tue, 25 Jul 2017 15:16:19 +0200 Subject: [PATCH 12/17] SC2128 fixing --- bootstrap.sh | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index b8d6f55d8..4da879609 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -75,19 +75,19 @@ command_not_found_handle () error () { - echo "$BASH_SOURCE:$BASH_LINENO: " "$*" >&2 + echo "${BASH_SOURCE[0]}:${BASH_LINENO[0]}: " "$*" >&2 } die () { - echo "$BASH_SOURCE:$BASH_LINENO: " "$*" >&2 + echo "${BASH_SOURCE[0]}:${BASH_LINENO[0]}: " "$*" >&2 exit 1; } warn () { - echo "$BASH_SOURCE:$BASH_LINENO: " "$*" - #echo "$BASH_SOURCE:$BASH_LINENO: $@" >&1 + echo "${BASH_SOURCE[0]}:${BASH_LINENO[0]}: " "$*" + #echo "$BASH_SOURCE:${BASH_LINENO[0]}: $@" >&1 } nassert () @@ -97,7 +97,7 @@ nassert () param_value="$(eval "expr \"$param_name\" ")" if [ -n "$param_value" ]; then - echo "$BASH_SOURCE:$BASH_LINENO: assert($param_name) had value of $param_value" >&2 + echo "${BASH_SOURCE[0]}:${BASH_LINENO[0]}: assert($param_name) had value of $param_value" >&2 exit 1 fi } @@ -109,7 +109,7 @@ assert () param_value="$(eval "expr \"$param_name\" ")" if [ -z "$param_value" ]; then - echo "$BASH_SOURCE:$BASH_LINENO: assert($param_name)" >&2 + echo "${BASH_SOURCE[0]}:${BASH_LINENO[0]}: assert($param_name)" >&2 exit 1 fi } @@ -117,7 +117,7 @@ assert () assert_file () { if [ ! -f "$1" ]; then - echo "$BASH_SOURCE:$BASH_LINENO: assert($1) does not exist: $2" >&2 + echo "${BASH_SOURCE[0]}:${BASH_LINENO[0]}: assert($1) does not exist: $2" >&2 exit 1; fi } @@ -125,7 +125,7 @@ assert_file () assert_no_file () { if [ -f "$1" ]; then - echo "$BASH_SOURCE:$BASH_LINENO: assert($1) file exists: $2" >&2 + echo "${BASH_SOURCE[0]}:${BASH_LINENO[0]}: assert($1) file exists: $2" >&2 exit 1; fi } @@ -133,7 +133,7 @@ assert_no_file () assert_no_directory () { if [ -d "$1" ]; then - echo "$BASH_SOURCE:$BASH_LINENO: assert($1) directory exists: $2" >&2 + echo "${BASH_SOURCE[0]}:${BASH_LINENO[0]}: assert($1) directory exists: $2" >&2 exit 1; fi } @@ -141,12 +141,12 @@ assert_no_directory () assert_exec_file () { if [ ! -f "$1" ]; then - echo "$BASH_SOURCE:$BASH_LINENO: assert($1) does not exist: $2" >&2 + echo "${BASH_SOURCE[0]}:${BASH_LINENO[0]}: assert($1) does not exist: $2" >&2 exit 1; fi if [ ! -x "$1" ]; then - echo "$BASH_SOURCE:$BASH_LINENO: assert($1) exists but is not executable: $2" >&2 + echo "${BASH_SOURCE[0]}:${BASH_LINENO[0]}: assert($1) exists but is not executable: $2" >&2 exit 1; fi } From c4089cca20f0aba7bf99c767a28e78d7dbf11243 Mon Sep 17 00:00:00 2001 From: Alexei Pastuchov Date: Tue, 25 Jul 2017 15:20:32 +0200 Subject: [PATCH 13/17] SC2193 fixing --- bootstrap.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index 4da879609..5f75f4410 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -243,9 +243,6 @@ set_VENDOR_RELEASE () ;; fedora) VENDOR_RELEASE="$release" - if [[ "x$VENDOR_RELEASE" == '18' ]]; then - VENDOR_RELEASE='sphericalcow' - fi ;; rhel) VENDOR_RELEASE="$release" From d65366b9ce527da750293bf2e89ba4b977fbd4f2 Mon Sep 17 00:00:00 2001 From: Alexei Pastuchov Date: Tue, 25 Jul 2017 15:29:05 +0200 Subject: [PATCH 14/17] SC2166 fixing --- bootstrap.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index 5f75f4410..a4d6b3145 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -716,7 +716,7 @@ make_for_mingw () fi # Make sure it is clean - if [ -f Makefile -o -f configure ]; then + if [ -f Makefile ] || [ -f configure ]; then make_maintainer_clean fi @@ -743,7 +743,7 @@ make_for_clang () fi # Make sure it is clean - if [ -f Makefile -o -f configure ]; then + if [ -f Makefile ] || [ -f configure ]; then make_maintainer_clean fi @@ -775,7 +775,7 @@ make_for_clang_analyzer () fi # Make sure it is clean - if [ -f Makefile -o -f configure ]; then + if [ -f Makefile ] || [ -f configure ]; then make_maintainer_clean fi @@ -998,7 +998,7 @@ make_distcheck () make_rpm () { if command_exists 'rpmbuild'; then - if [ -f 'rpm.am' -o -d 'rpm' ]; then + if [ -f 'rpm.am' ] || [ -d 'rpm' ]; then run_configure_if_required make_target 'dist-rpm' From 29e09c29e080ada556ee20dbb9b20f3da6f99d7e Mon Sep 17 00:00:00 2001 From: Alexei Pastuchov Date: Tue, 25 Jul 2017 15:30:16 +0200 Subject: [PATCH 15/17] SC2206 fixing --- bootstrap.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap.sh b/bootstrap.sh index a4d6b3145..53d599b80 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -1541,7 +1541,7 @@ execute_job () fi local BOOTSTRAP_TARGET_ARRAY - BOOTSTRAP_TARGET_ARRAY=( $BOOTSTRAP_TARGET ) + BOOTSTRAP_TARGET_ARRAY=( "$BOOTSTRAP_TARGET" ) for target in "${BOOTSTRAP_TARGET_ARRAY[@]}" do From 4f1dc0622f1cf21112923cc0a92da5213e37c65a Mon Sep 17 00:00:00 2001 From: Alexei Pastuchov Date: Tue, 25 Jul 2017 15:32:35 +0200 Subject: [PATCH 16/17] SC2181 fixing --- bootstrap.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index 53d599b80..817b674ff 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -836,8 +836,9 @@ make_universe () make_for_clang_analyzer use_banner 'mingw' - check_mingw - if [ $? -eq 0 ]; then + + if ! check_mingw + then make_for_mingw fi From a1edc03536957344fd1a976690b47c1d9b4661c6 Mon Sep 17 00:00:00 2001 From: Alexei Pastuchov Date: Tue, 25 Jul 2017 21:26:34 +0200 Subject: [PATCH 17/17] SC1091 disabled --- bootstrap.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bootstrap.sh b/bootstrap.sh index 817b674ff..e820a6bbe 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -355,6 +355,7 @@ determine_target_platform () _vendor="$(rpm -qf /etc/redhat-release)" set_VENDOR "$_vendor" 'rhel' "$rhel_version" elif [[ -f '/etc/os-release' ]]; then + # shellcheck disable=SC1091 source '/etc/os-release' set_VENDOR "$ID" "$ID" "$VERSION_ID" elif [[ -x '/usr/bin/lsb_release' ]]; then @@ -364,6 +365,7 @@ determine_target_platform () _VERSION="$(/usr/bin/lsb_release -s -r)" set_VENDOR "$_ID" "$_ID" "$_VERSION_ID" elif [[ -f '/etc/lsb-release' ]]; then + # shellcheck disable=SC1091 source '/etc/lsb-release' set_VENDOR 'canonical' "$DISTRIB_ID" "$DISTRIB_CODENAME" fi @@ -1865,6 +1867,7 @@ bootstrap () BOOTSTRAP_SNAPSHOT_CHECK= if [ -f '.bootstrap' ]; then + # shellcheck disable=SC1091 source '.bootstrap' fi