ShellCheck - shell script analysis tool version: 0.10.0 license: GNU General Public License, version 3 website: https://www.shellcheck.net Redirect to /tmp/tmp.pQKWBcEdqi and /tmp/tmp.WuGgWP6rOo Tree base: 8ab02c1024e9 ("selftests/vsock: add tests for module loading order") Now at: 4a9a30d76fb9 ("selftests/vsock: add 1.37 to tested virtme-ng versions") ====== Checking before the patch ====== Checking tools/testing/selftests/vsock/vmtest.sh - 3bbe24ed85577bc751e7e913126d8b44bb8554cc21519ace46c3118b1749f848 In vmtest.sh line 12: readonly SCRIPT_DIR="$(cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)" ^--------^ SC2155 (warning): Declare and assign separately to avoid masking return values. In vmtest.sh line 13: readonly KERNEL_CHECKOUT=$(realpath "${SCRIPT_DIR}"/../../../../) ^-------------^ SC2155 (warning): Declare and assign separately to avoid masking return values. In vmtest.sh line 41: readonly LOG=$(mktemp /tmp/vsock_vmtest_XXXX.log) ^-^ SC2155 (warning): Declare and assign separately to avoid masking return values. In vmtest.sh line 272: ${ns_exec} ssh -q -o UserKnownHostsFile=/dev/null -p ${SSH_HOST_PORT} localhost $* ^-- SC2048 (warning): Use "$@" (with quotes) to prevent whitespace problems. ^-- SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: ${ns_exec} ssh -q -o UserKnownHostsFile=/dev/null -p ${SSH_HOST_PORT} localhost "$*" In vmtest.sh line 383: pushd "${KERNEL_CHECKOUT}" &>/dev/null ^-- SC2164 (warning): Use 'pushd ... || exit' or 'pushd ... || return' in case pushd fails. Did you mean: pushd "${KERNEL_CHECKOUT}" &>/dev/null || exit In vmtest.sh line 389: if ! make -j$(nproc); then ^------^ SC2046 (warning): Quote this to prevent word splitting. In vmtest.sh line 393: popd &>/dev/null ^--------------^ SC2164 (warning): Use 'popd ... || exit' or 'popd ... || return' in case popd fails. Did you mean: popd &>/dev/null || exit In vmtest.sh line 452: ${kernel_opt} \ ^-----------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: "${kernel_opt}" \ In vmtest.sh line 558: 2>&1 | log_guest ^-------^ SC2119 (info): Use log_guest "$@" if function's $1 should mean script's $1. In vmtest.sh line 566: 2>&1 | log_guest & ^-------^ SC2119 (info): Use log_guest "$@" if function's $1 should mean script's $1. In vmtest.sh line 571: return $rc ^-^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$rc" In vmtest.sh line 579: return $rc ^-^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$rc" In vmtest.sh line 611: return $rc ^-^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$rc" In vmtest.sh line 619: return $rc ^-^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$rc" In vmtest.sh line 650: LOG_PREFIX=host log $@ ^-- SC2068 (error): Double quote array expansions to avoid re-splitting elements. In vmtest.sh line 653: log_guest() { ^-- SC2120 (warning): log_guest references arguments, but none are ever passed. In vmtest.sh line 654: LOG_PREFIX=guest log $@ ^-- SC2068 (error): Double quote array expansions to avoid re-splitting elements. In vmtest.sh line 684: pidfile=$(mktemp $PIDFILE_TEMPLATE) ^---------------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: pidfile=$(mktemp "$PIDFILE_TEMPLATE") In vmtest.sh line 733: pidfile=$(mktemp $PIDFILE_TEMPLATE) ^---------------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: pidfile=$(mktemp "$PIDFILE_TEMPLATE") In vmtest.sh line 736: return $KSFT_FAIL ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$KSFT_FAIL" In vmtest.sh line 750: return $KSFT_PASS ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$KSFT_PASS" In vmtest.sh line 753: return $KSFT_FAIL ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$KSFT_FAIL" In vmtest.sh line 783: pidfile=$(mktemp $PIDFILE_TEMPLATE) ^---------------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: pidfile=$(mktemp "$PIDFILE_TEMPLATE") In vmtest.sh line 788: return $KSFT_FAIL ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$KSFT_FAIL" In vmtest.sh line 819: ip netns exec "${ns1}" socat VSOCK-LISTEN:${port} STDOUT &> "${outfile}" & ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: ip netns exec "${ns1}" socat VSOCK-LISTEN:"${port}" STDOUT &> "${outfile}" & In vmtest.sh line 822: pidfile=$(mktemp $PIDFILE_TEMPLATE) ^---------------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: pidfile=$(mktemp "$PIDFILE_TEMPLATE") In vmtest.sh line 827: return $KSFT_FAIL ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$KSFT_FAIL" In vmtest.sh line 833: bash -c "echo TEST | socat STDIN VSOCK-CONNECT:2:${port}" 2>&1 | log_guest ^-------^ SC2119 (info): Use log_guest "$@" if function's $1 should mean script's $1. In vmtest.sh line 860: pidfile=$(mktemp $PIDFILE_TEMPLATE) ^---------------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: pidfile=$(mktemp "$PIDFILE_TEMPLATE") In vmtest.sh line 863: return $KSFT_FAIL ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$KSFT_FAIL" In vmtest.sh line 877: return $KSFT_PASS ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$KSFT_PASS" In vmtest.sh line 880: return $KSFT_FAIL ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$KSFT_FAIL" In vmtest.sh line 898: pidfile=$(mktemp $PIDFILE_TEMPLATE) ^---------------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: pidfile=$(mktemp "$PIDFILE_TEMPLATE") In vmtest.sh line 908: bash -c "echo TEST | socat STDIN VSOCK-CONNECT:2:${port}" 2>&1 | log_guest ^-------^ SC2119 (info): Use log_guest "$@" if function's $1 should mean script's $1. In vmtest.sh line 930: if [[ "$(lsmod | grep -c ${module})" -eq 0 ]]; then ^-------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: if [[ "$(lsmod | grep -c "${module}")" -eq 0 ]]; then In vmtest.sh line 1026: pidfile=$(mktemp $PIDFILE_TEMPLATE) ^---------------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: pidfile=$(mktemp "$PIDFILE_TEMPLATE") In vmtest.sh line 1053: pidfile=$(mktemp $PIDFILE_TEMPLATE) ^---------------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: pidfile=$(mktemp "$PIDFILE_TEMPLATE") In vmtest.sh line 1078: pidfile1=$(mktemp $PIDFILE_TEMPLATE) ^---------------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: pidfile1=$(mktemp "$PIDFILE_TEMPLATE") In vmtest.sh line 1081: pidfile2=$(mktemp $PIDFILE_TEMPLATE) ^---------------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: pidfile2=$(mktemp "$PIDFILE_TEMPLATE") In vmtest.sh line 1087: return $rc ^-^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$rc" In vmtest.sh line 1204: pidfile=$(mktemp $PIDFILE_TEMPLATE) ^---------------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: pidfile=$(mktemp "$PIDFILE_TEMPLATE") In vmtest.sh line 1218: sleep ${WAIT_PERIOD} ^------------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: sleep "${WAIT_PERIOD}" In vmtest.sh line 1222: local pipefile=$(mktemp -u /tmp/vmtest_pipe_XXXX) ^------^ SC2155 (warning): Declare and assign separately to avoid masking return values. In vmtest.sh line 1227: timeout ${WAIT_PERIOD} \ ^------------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: timeout "${WAIT_PERIOD}" \ In vmtest.sh line 1252: timeout ${WAIT_PERIOD} \ ^------------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: timeout "${WAIT_PERIOD}" \ In vmtest.sh line 1376: ip netns exec "${ns0}" socat VSOCK-LISTEN:${port} STDOUT \ ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: ip netns exec "${ns0}" socat VSOCK-LISTEN:"${port}" STDOUT \ In vmtest.sh line 1381: ip netns exec "${ns1}" socat STDIN VSOCK-CONNECT:1:${port} \ ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: ip netns exec "${ns1}" socat STDIN VSOCK-CONNECT:1:"${port}" \ In vmtest.sh line 1461: host_oops_cnt_after=$(dmesg | grep -i 'Oops' | wc -l) ^------------^ SC2126 (style): Consider using 'grep -c' instead of 'grep|wc -l'. In vmtest.sh line 1473: vm_oops_cnt_after=$(vm_ssh "init_ns" -- dmesg | grep -i 'Oops' | wc -l) ^------------^ SC2126 (style): Consider using 'grep -c' instead of 'grep|wc -l'. For more information: https://www.shellcheck.net/wiki/SC2068 -- Double quote array expansions to ... https://www.shellcheck.net/wiki/SC2046 -- Quote this to prevent word splitt... https://www.shellcheck.net/wiki/SC2048 -- Use "$@" (with quotes) to prevent... ====== Checking the tree with the patch ====== Checking tools/testing/selftests/vsock/vmtest.sh - 3bbe24ed85577bc751e7e913126d8b44bb8554cc21519ace46c3118b1749f848 In vmtest.sh line 12: readonly SCRIPT_DIR="$(cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)" ^--------^ SC2155 (warning): Declare and assign separately to avoid masking return values. In vmtest.sh line 13: readonly KERNEL_CHECKOUT=$(realpath "${SCRIPT_DIR}"/../../../../) ^-------------^ SC2155 (warning): Declare and assign separately to avoid masking return values. In vmtest.sh line 41: readonly LOG=$(mktemp /tmp/vsock_vmtest_XXXX.log) ^-^ SC2155 (warning): Declare and assign separately to avoid masking return values. In vmtest.sh line 272: ${ns_exec} ssh -q -o UserKnownHostsFile=/dev/null -p ${SSH_HOST_PORT} localhost $* ^-- SC2048 (warning): Use "$@" (with quotes) to prevent whitespace problems. ^-- SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: ${ns_exec} ssh -q -o UserKnownHostsFile=/dev/null -p ${SSH_HOST_PORT} localhost "$*" In vmtest.sh line 383: pushd "${KERNEL_CHECKOUT}" &>/dev/null ^-- SC2164 (warning): Use 'pushd ... || exit' or 'pushd ... || return' in case pushd fails. Did you mean: pushd "${KERNEL_CHECKOUT}" &>/dev/null || exit In vmtest.sh line 389: if ! make -j$(nproc); then ^------^ SC2046 (warning): Quote this to prevent word splitting. In vmtest.sh line 393: popd &>/dev/null ^--------------^ SC2164 (warning): Use 'popd ... || exit' or 'popd ... || return' in case popd fails. Did you mean: popd &>/dev/null || exit In vmtest.sh line 452: ${kernel_opt} \ ^-----------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: "${kernel_opt}" \ In vmtest.sh line 558: 2>&1 | log_guest ^-------^ SC2119 (info): Use log_guest "$@" if function's $1 should mean script's $1. In vmtest.sh line 566: 2>&1 | log_guest & ^-------^ SC2119 (info): Use log_guest "$@" if function's $1 should mean script's $1. In vmtest.sh line 571: return $rc ^-^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$rc" In vmtest.sh line 579: return $rc ^-^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$rc" In vmtest.sh line 611: return $rc ^-^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$rc" In vmtest.sh line 619: return $rc ^-^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$rc" In vmtest.sh line 650: LOG_PREFIX=host log $@ ^-- SC2068 (error): Double quote array expansions to avoid re-splitting elements. In vmtest.sh line 653: log_guest() { ^-- SC2120 (warning): log_guest references arguments, but none are ever passed. In vmtest.sh line 654: LOG_PREFIX=guest log $@ ^-- SC2068 (error): Double quote array expansions to avoid re-splitting elements. In vmtest.sh line 684: pidfile=$(mktemp $PIDFILE_TEMPLATE) ^---------------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: pidfile=$(mktemp "$PIDFILE_TEMPLATE") In vmtest.sh line 733: pidfile=$(mktemp $PIDFILE_TEMPLATE) ^---------------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: pidfile=$(mktemp "$PIDFILE_TEMPLATE") In vmtest.sh line 736: return $KSFT_FAIL ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$KSFT_FAIL" In vmtest.sh line 750: return $KSFT_PASS ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$KSFT_PASS" In vmtest.sh line 753: return $KSFT_FAIL ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$KSFT_FAIL" In vmtest.sh line 783: pidfile=$(mktemp $PIDFILE_TEMPLATE) ^---------------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: pidfile=$(mktemp "$PIDFILE_TEMPLATE") In vmtest.sh line 788: return $KSFT_FAIL ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$KSFT_FAIL" In vmtest.sh line 819: ip netns exec "${ns1}" socat VSOCK-LISTEN:${port} STDOUT &> "${outfile}" & ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: ip netns exec "${ns1}" socat VSOCK-LISTEN:"${port}" STDOUT &> "${outfile}" & In vmtest.sh line 822: pidfile=$(mktemp $PIDFILE_TEMPLATE) ^---------------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: pidfile=$(mktemp "$PIDFILE_TEMPLATE") In vmtest.sh line 827: return $KSFT_FAIL ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$KSFT_FAIL" In vmtest.sh line 833: bash -c "echo TEST | socat STDIN VSOCK-CONNECT:2:${port}" 2>&1 | log_guest ^-------^ SC2119 (info): Use log_guest "$@" if function's $1 should mean script's $1. In vmtest.sh line 860: pidfile=$(mktemp $PIDFILE_TEMPLATE) ^---------------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: pidfile=$(mktemp "$PIDFILE_TEMPLATE") In vmtest.sh line 863: return $KSFT_FAIL ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$KSFT_FAIL" In vmtest.sh line 877: return $KSFT_PASS ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$KSFT_PASS" In vmtest.sh line 880: return $KSFT_FAIL ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$KSFT_FAIL" In vmtest.sh line 898: pidfile=$(mktemp $PIDFILE_TEMPLATE) ^---------------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: pidfile=$(mktemp "$PIDFILE_TEMPLATE") In vmtest.sh line 908: bash -c "echo TEST | socat STDIN VSOCK-CONNECT:2:${port}" 2>&1 | log_guest ^-------^ SC2119 (info): Use log_guest "$@" if function's $1 should mean script's $1. In vmtest.sh line 930: if [[ "$(lsmod | grep -c ${module})" -eq 0 ]]; then ^-------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: if [[ "$(lsmod | grep -c "${module}")" -eq 0 ]]; then In vmtest.sh line 1026: pidfile=$(mktemp $PIDFILE_TEMPLATE) ^---------------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: pidfile=$(mktemp "$PIDFILE_TEMPLATE") In vmtest.sh line 1053: pidfile=$(mktemp $PIDFILE_TEMPLATE) ^---------------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: pidfile=$(mktemp "$PIDFILE_TEMPLATE") In vmtest.sh line 1078: pidfile1=$(mktemp $PIDFILE_TEMPLATE) ^---------------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: pidfile1=$(mktemp "$PIDFILE_TEMPLATE") In vmtest.sh line 1081: pidfile2=$(mktemp $PIDFILE_TEMPLATE) ^---------------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: pidfile2=$(mktemp "$PIDFILE_TEMPLATE") In vmtest.sh line 1087: return $rc ^-^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$rc" In vmtest.sh line 1204: pidfile=$(mktemp $PIDFILE_TEMPLATE) ^---------------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: pidfile=$(mktemp "$PIDFILE_TEMPLATE") In vmtest.sh line 1218: sleep ${WAIT_PERIOD} ^------------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: sleep "${WAIT_PERIOD}" In vmtest.sh line 1222: local pipefile=$(mktemp -u /tmp/vmtest_pipe_XXXX) ^------^ SC2155 (warning): Declare and assign separately to avoid masking return values. In vmtest.sh line 1227: timeout ${WAIT_PERIOD} \ ^------------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: timeout "${WAIT_PERIOD}" \ In vmtest.sh line 1252: timeout ${WAIT_PERIOD} \ ^------------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: timeout "${WAIT_PERIOD}" \ In vmtest.sh line 1376: ip netns exec "${ns0}" socat VSOCK-LISTEN:${port} STDOUT \ ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: ip netns exec "${ns0}" socat VSOCK-LISTEN:"${port}" STDOUT \ In vmtest.sh line 1381: ip netns exec "${ns1}" socat STDIN VSOCK-CONNECT:1:${port} \ ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: ip netns exec "${ns1}" socat STDIN VSOCK-CONNECT:1:"${port}" \ In vmtest.sh line 1461: host_oops_cnt_after=$(dmesg | grep -i 'Oops' | wc -l) ^------------^ SC2126 (style): Consider using 'grep -c' instead of 'grep|wc -l'. In vmtest.sh line 1473: vm_oops_cnt_after=$(vm_ssh "init_ns" -- dmesg | grep -i 'Oops' | wc -l) ^------------^ SC2126 (style): Consider using 'grep -c' instead of 'grep|wc -l'. For more information: https://www.shellcheck.net/wiki/SC2068 -- Double quote array expansions to ... https://www.shellcheck.net/wiki/SC2046 -- Quote this to prevent word splitt... https://www.shellcheck.net/wiki/SC2048 -- Use "$@" (with quotes) to prevent...