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.JWX0Yzy3Kk and /tmp/tmp.pH5qnRwj4T Tree base: 3b5b1c428260 ("eth: gianfar: migrate to new RXFH callbacks") Now at: 77b81950533a ("selftests/vsock: add NS tests to vmtest.sh") ====== Checking before the patch ====== Checking tools/testing/selftests/vsock/vmtest.sh - 3bbe24ed85577bc751e7e913126d8b44bb8554cc21519ace46c3118b1749f848 In vmtest.sh line 11: 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 12: readonly KERNEL_CHECKOUT=$(realpath "${SCRIPT_DIR}"/../../../../) ^-------------^ SC2155 (warning): Declare and assign separately to avoid masking return values. In vmtest.sh line 26: readonly QEMU_PIDFILE=$(mktemp /tmp/qemu_vsock_vmtest_XXXX.pid) ^----------^ SC2155 (warning): Declare and assign separately to avoid masking return values. In vmtest.sh line 46: readonly LOG=$(mktemp /tmp/vsock_vmtest_XXXX.log) ^-^ SC2155 (warning): Declare and assign separately to avoid masking return values. In vmtest.sh line 178: 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 184: if ! make -j$(nproc); then ^------^ SC2046 (warning): Quote this to prevent word splitting. In vmtest.sh line 188: 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 210: ${kernel_opt} \ ^-----------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: "${kernel_opt}" \ In vmtest.sh line 400: 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 412: vm_oops_cnt_after=$(vm_ssh -- 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/SC2046 -- Quote this to prevent word splitt... https://www.shellcheck.net/wiki/SC2155 -- Declare and assign separately to ... https://www.shellcheck.net/wiki/SC2164 -- Use 'popd ... || exit' or 'popd .... ====== Checking the tree with the patch ====== Checking tools/testing/selftests/vsock/vmtest.sh - 3bbe24ed85577bc751e7e913126d8b44bb8554cc21519ace46c3118b1749f848 In vmtest.sh line 53: 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 54: readonly KERNEL_CHECKOUT=$(realpath "${SCRIPT_DIR}"/../../../../) ^-------------^ SC2155 (warning): Declare and assign separately to avoid masking return values. In vmtest.sh line 78: readonly LOG=$(mktemp /tmp/vsock_vmtest_XXXX.log) ^-^ SC2155 (warning): Declare and assign separately to avoid masking return values. In vmtest.sh line 88: readonly LOG=$(mktemp /tmp/vsock_vmtest_XXXX.log) ^-^ SC2155 (warning): Declare and assign separately to avoid masking return values. In vmtest.sh line 155: terminate_pidfiles ${PIDFILES[@]} ^------------^ SC2068 (error): Double quote array expansions to avoid re-splitting elements. In vmtest.sh line 169: ${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 177: for pidfile in $@; do ^-- SC2068 (error): Double quote array expansions to avoid re-splitting elements. In vmtest.sh line 179: pkill -SIGTERM -F ${pidfile} 2>&1 > /dev/null ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. ^--^ SC2069 (warning): To redirect stdout+stderr, 2>&1 must be last (or use '{ cmd > file; } 2>&1' to clarify). Did you mean: pkill -SIGTERM -F "${pidfile}" 2>&1 > /dev/null In vmtest.sh line 264: 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 270: if ! make -j$(nproc); then ^------^ SC2046 (warning): Quote this to prevent word splitting. In vmtest.sh line 274: 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 280: local verify_boot=${3:-1} ^---------^ SC2034 (warning): verify_boot appears unused. Verify use (or export if used externally). In vmtest.sh line 305: if [[ ! -z "${ns}" ]]; then ^-- SC2236 (style): Use -n instead of ! -z. In vmtest.sh line 316: ${kernel_opt} \ ^-----------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: "${kernel_opt}" \ In vmtest.sh line 328: vm_wait_for_ssh() { ^-- SC2120 (warning): vm_wait_for_ssh references arguments, but none are ever passed. In vmtest.sh line 333: while [[ true ]]; do ^--^ SC2160 (style): Instead of '[ true ]', just use 'true'. In vmtest.sh line 337: if [[ ! -z "${ns}" ]]; then ^-- SC2236 (style): Use -n instead of ! -z. In vmtest.sh line 342: if [[ $? -eq 0 ]]; then ^-- SC2181 (style): Check exit code directly with e.g. 'if mycmd;', not indirectly with $?. In vmtest.sh line 385: wait_for_listener ${TEST_HOST_PORT_LISTENER} ${WAIT_PERIOD} ${WAIT_PERIOD_MAX} ^------------------------^ SC2086 (info): Double quote to prevent globbing and word splitting. ^------------^ SC2086 (info): Double quote to prevent globbing and word splitting. ^----------------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: wait_for_listener "${TEST_HOST_PORT_LISTENER}" "${WAIT_PERIOD}" "${WAIT_PERIOD_MAX}" In vmtest.sh line 506: return ${KSFT_FAIL} ^----------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "${KSFT_FAIL}" In vmtest.sh line 511: return ${KSFT_FAIL} ^----------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "${KSFT_FAIL}" In vmtest.sh line 545: local addr1 ^---^ SC2034 (warning): addr1 appears unused. Verify use (or export if used externally). In vmtest.sh line 568: return ${KSFT_FAIL} ^----------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "${KSFT_FAIL}" In vmtest.sh line 574: return ${KSFT_FAIL} ^----------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "${KSFT_FAIL}" In vmtest.sh line 579: return ${KSFT_FAIL} ^----------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "${KSFT_FAIL}" In vmtest.sh line 585: return ${KSFT_FAIL} ^----------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "${KSFT_FAIL}" In vmtest.sh line 591: return ${KSFT_FAIL} ^----------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "${KSFT_FAIL}" In vmtest.sh line 597: return ${KSFT_FAIL} ^----------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "${KSFT_FAIL}" In vmtest.sh line 602: return ${KSFT_FAIL} ^----------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "${KSFT_FAIL}" In vmtest.sh line 622: 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 624: vm_start ${cid} ${ns1} ${pidfile1} ^----^ SC2086 (info): Double quote to prevent globbing and word splitting. ^----^ SC2086 (info): Double quote to prevent globbing and word splitting. ^---------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: vm_start "${cid}" "${ns1}" "${pidfile1}" In vmtest.sh line 630: 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 632: WAIT_TOTAL=30 vm_start ${cid} ${ns2} ${pidfile2} ^----^ SC2086 (info): Double quote to prevent globbing and word splitting. ^----^ SC2086 (info): Double quote to prevent globbing and word splitting. ^---------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: WAIT_TOTAL=30 vm_start "${cid}" "${ns2}" "${pidfile2}" In vmtest.sh line 650: terminate_pidfiles ${pidfile1} ${pidfile2} ^---------^ SC2086 (info): Double quote to prevent globbing and word splitting. ^---------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: terminate_pidfiles "${pidfile1}" "${pidfile2}" In vmtest.sh line 651: return $rc ^-^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$rc" In vmtest.sh line 656: return $KSFT_FAIL ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$KSFT_FAIL" In vmtest.sh line 659: return $KSFT_PASS ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$KSFT_PASS" In vmtest.sh line 664: return $KSFT_PASS ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$KSFT_PASS" In vmtest.sh line 667: return $KSFT_FAIL ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$KSFT_FAIL" In vmtest.sh line 672: return $KSFT_PASS ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$KSFT_PASS" In vmtest.sh line 675: return $KSFT_FAIL ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$KSFT_FAIL" In vmtest.sh line 680: return $KSFT_FAIL ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$KSFT_FAIL" In vmtest.sh line 683: return $KSFT_PASS ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$KSFT_PASS" In vmtest.sh line 697: if ! vm_start ${cid} "${host_ns}"; then ^----^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: if ! vm_start "${cid}" "${host_ns}"; then In vmtest.sh line 699: return $KSFT_FAIL ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$KSFT_FAIL" In vmtest.sh line 708: vm_wait_for_listener ${TEST_GUEST_PORT} "${host_ns}" ^----------------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: vm_wait_for_listener "${TEST_GUEST_PORT}" "${host_ns}" In vmtest.sh line 711: ip netns exec "${host_ns}" socat TCP-LISTEN:${BRIDGE_PORT},fork \ ^------------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: ip netns exec "${host_ns}" socat TCP-LISTEN:"${BRIDGE_PORT}",fork \ In vmtest.sh line 712: TCP-CONNECT:localhost:${TEST_HOST_PORT} & ^---------------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: TCP-CONNECT:localhost:"${TEST_HOST_PORT}" & In vmtest.sh line 716: socat TCP:10.0.0.1:${BRIDGE_PORT} TCP-LISTEN:${TEST_HOST_PORT},fork & ^------------^ SC2086 (info): Double quote to prevent globbing and word splitting. ^---------------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: socat TCP:10.0.0.1:"${BRIDGE_PORT}" TCP-LISTEN:"${TEST_HOST_PORT}",fork & In vmtest.sh line 720: ip netns exec "${host_ns2}" ${VSOCK_TEST} \ ^-----------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: ip netns exec "${host_ns2}" "${VSOCK_TEST}" \ 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 733: return $KSFT_PASS ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$KSFT_PASS" In vmtest.sh line 748: if ! vm_start ${cid} "${host_ns}"; then ^----^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: if ! vm_start "${cid}" "${host_ns}"; then In vmtest.sh line 750: return $KSFT_FAIL ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$KSFT_FAIL" In vmtest.sh line 753: ip netns exec "${host_ns2}" ${VSOCK_TEST} \ ^-----------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: ip netns exec "${host_ns2}" "${VSOCK_TEST}" \ In vmtest.sh line 761: socat TCP-LISTEN:${BRIDGE_PORT},bind=10.0.0.2,fork \ ^------------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: socat TCP-LISTEN:"${BRIDGE_PORT}",bind=10.0.0.2,fork \ In vmtest.sh line 762: TCP:localhost:${port} & ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: TCP:localhost:"${port}" & In vmtest.sh line 766: ip netns exec "${host_ns}" socat TCP-LISTEN:${port},fork \ ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: ip netns exec "${host_ns}" socat TCP-LISTEN:"${port}",fork \ In vmtest.sh line 767: TCP-CONNECT:10.0.0.2:${BRIDGE_PORT} & ^------------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: TCP-CONNECT:10.0.0.2:"${BRIDGE_PORT}" & In vmtest.sh line 779: if [[ ! $? -eq 0 ]]; then ^-- SC2181 (style): Check exit code directly with e.g. 'if mycmd;', not indirectly with $?. 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 785: return $KSFT_PASS ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$KSFT_PASS" In vmtest.sh line 793: do_ns_vm_client_host_server_test ${testname} ${host_ns} ${host_ns2} ^---------^ SC2086 (info): Double quote to prevent globbing and word splitting. ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. ^---------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: do_ns_vm_client_host_server_test "${testname}" "${host_ns}" "${host_ns2}" In vmtest.sh line 801: do_ns_vm_client_host_server_test ${testname} ${host_ns} ${host_ns2} ^---------^ SC2086 (info): Double quote to prevent globbing and word splitting. ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. ^---------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: do_ns_vm_client_host_server_test "${testname}" "${host_ns}" "${host_ns2}" In vmtest.sh line 825: 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 837: vm_oops_cnt_after=$(vm_ssh -- dmesg | grep -i 'Oops' | wc -l) ^------------^ SC2126 (style): Consider using 'grep -c' instead of 'grep|wc -l'. In vmtest.sh line 857: for testname in ${NEEDS_SETUP[@]}; do ^---------------^ SC2068 (error): Double quote array expansions to avoid re-splitting elements. In vmtest.sh line 917: setup_done=0 ^--------^ SC2034 (warning): setup_done appears unused. Verify use (or export if used externally). In vmtest.sh line 920: for arg in ${ARGS[@]}; do ^--------^ SC2068 (error): Double quote array expansions to avoid re-splitting elements. In vmtest.sh line 926: vm_wait_for_ssh ^-------------^ SC2119 (info): Use vm_wait_for_ssh "$@" if function's $1 should mean script's $1. In vmtest.sh line 934: if [[ ! -z "${pidfile}" ]]; then ^-- SC2236 (style): Use -n instead of ! -z. For more information: https://www.shellcheck.net/wiki/SC2068 -- Double quote array expansions to ... https://www.shellcheck.net/wiki/SC2034 -- addr1 appears unused. Verify use ... https://www.shellcheck.net/wiki/SC2046 -- Quote this to prevent word splitt...