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.jLto5pOJ2T and /tmp/tmp.iqYa9kmcRk Tree base: ee66632e84aa ("selftests/vsock: add tests for host <-> vm connectivity with namespaces") Now at: ee47ca86bfb6 ("selftests/vsock: add tests for namespace deletion and mode changes") ====== 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 240: ${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 351: 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 357: if ! make -j$(nproc); then ^------^ SC2046 (warning): Quote this to prevent word splitting. In vmtest.sh line 361: 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 420: ${kernel_opt} \ ^-----------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: "${kernel_opt}" \ In vmtest.sh line 526: 2>&1 | log_guest ^-------^ SC2119 (info): Use log_guest "$@" if function's $1 should mean script's $1. In vmtest.sh line 534: 2>&1 | log_guest & ^-------^ SC2119 (info): Use log_guest "$@" if function's $1 should mean script's $1. In vmtest.sh line 539: return $rc ^-^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$rc" In vmtest.sh line 547: 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 587: return $rc ^-^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$rc" In vmtest.sh line 618: LOG_PREFIX=host log $@ ^-- SC2068 (error): Double quote array expansions to avoid re-splitting elements. In vmtest.sh line 621: log_guest() { ^-- SC2120 (warning): log_guest references arguments, but none are ever passed. In vmtest.sh line 622: LOG_PREFIX=guest log $@ ^-- SC2068 (error): Double quote array expansions to avoid re-splitting elements. In vmtest.sh line 652: 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 701: 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 704: return $KSFT_FAIL ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$KSFT_FAIL" In vmtest.sh line 718: return $KSFT_PASS ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$KSFT_PASS" In vmtest.sh line 721: return $KSFT_FAIL ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$KSFT_FAIL" In vmtest.sh line 751: 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 756: return $KSFT_FAIL ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$KSFT_FAIL" In vmtest.sh line 787: 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 790: 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 795: return $KSFT_FAIL ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$KSFT_FAIL" In vmtest.sh line 801: 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 828: 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 831: return $KSFT_FAIL ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$KSFT_FAIL" In vmtest.sh line 845: return $KSFT_PASS ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$KSFT_PASS" In vmtest.sh line 848: return $KSFT_FAIL ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$KSFT_FAIL" In vmtest.sh line 866: 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 876: 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 977: 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 1004: 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 1029: 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 1032: 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 1038: return $rc ^-^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$rc" In vmtest.sh line 1207: 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 1219: 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 264: ${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 375: 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 381: if ! make -j$(nproc); then ^------^ SC2046 (warning): Quote this to prevent word splitting. In vmtest.sh line 385: 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 444: ${kernel_opt} \ ^-----------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: "${kernel_opt}" \ In vmtest.sh line 550: 2>&1 | log_guest ^-------^ SC2119 (info): Use log_guest "$@" if function's $1 should mean script's $1. 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 563: return $rc ^-^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$rc" 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 603: 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 642: LOG_PREFIX=host log $@ ^-- SC2068 (error): Double quote array expansions to avoid re-splitting elements. In vmtest.sh line 645: log_guest() { ^-- SC2120 (warning): log_guest references arguments, but none are ever passed. In vmtest.sh line 646: LOG_PREFIX=guest log $@ ^-- SC2068 (error): Double quote array expansions to avoid re-splitting elements. In vmtest.sh line 676: 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 725: 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 728: return $KSFT_FAIL ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$KSFT_FAIL" In vmtest.sh line 742: return $KSFT_PASS ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$KSFT_PASS" In vmtest.sh line 745: return $KSFT_FAIL ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$KSFT_FAIL" In vmtest.sh line 775: 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 780: return $KSFT_FAIL ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$KSFT_FAIL" In vmtest.sh line 811: 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 814: 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 819: return $KSFT_FAIL ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$KSFT_FAIL" In vmtest.sh line 825: 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 852: 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 855: return $KSFT_FAIL ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$KSFT_FAIL" In vmtest.sh line 869: return $KSFT_PASS ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$KSFT_PASS" In vmtest.sh line 872: return $KSFT_FAIL ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$KSFT_FAIL" In vmtest.sh line 890: 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 900: 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 1001: 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 1028: 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: 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 1056: 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 1062: return $rc ^-^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$rc" In vmtest.sh line 1179: 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 1193: sleep ${WAIT_PERIOD} ^------------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: sleep "${WAIT_PERIOD}" In vmtest.sh line 1197: local pipefile=$(mktemp -u /tmp/vmtest_pipe_XXXX) ^------^ SC2155 (warning): Declare and assign separately to avoid masking return values. In vmtest.sh line 1202: timeout ${WAIT_PERIOD} \ ^------------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: timeout "${WAIT_PERIOD}" \ 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 1330: 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 1342: 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...