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.Zu3iPdNbSG and /tmp/tmp.HClfnU8jL9 Tree base: dc9d3810b5a4 ("selftests/vsock: invoke vsock_test through helpers") Now at: 7c7869603c55 ("selftests/vsock: add namespace tests") ====== 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 57: readonly LOG_LEVEL_ERROR=3 ^-------------^ SC2034 (warning): LOG_LEVEL_ERROR appears unused. Verify use (or export if used externally). In vmtest.sh line 136: for dep in vng ${QEMU} busybox pkill ssh; do ^-----^ SC2153 (info): Possible misspelling: QEMU may not be assigned. Did you mean qemu? In vmtest.sh line 183: 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 189: if ! make -j$(nproc); then ^------^ SC2046 (warning): Quote this to prevent word splitting. In vmtest.sh line 193: 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 215: ${kernel_opt} \ ^-----------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: "${kernel_opt}" \ In vmtest.sh line 321: log_host() { ^-- SC2120 (warning): log_host references arguments, but none are ever passed. In vmtest.sh line 322: LOG_PREFIX=host log $@ ^-- SC2068 (error): Double quote array expansions to avoid re-splitting elements. In vmtest.sh line 325: log_guest() { ^-- SC2120 (warning): log_guest references arguments, but none are ever passed. In vmtest.sh line 326: LOG_PREFIX=guest log $@ ^-- SC2068 (error): Double quote array expansions to avoid re-splitting elements. In vmtest.sh line 346: 2>&1 | log_guest ^-------^ SC2119 (info): Use log_guest "$@" if function's $1 should mean script's $1. In vmtest.sh line 357: 2>&1 | log_guest & ^-------^ SC2119 (info): Use log_guest "$@" if function's $1 should mean script's $1. In vmtest.sh line 395: --control-port="${port}" 2>&1 | log_host ^------^ SC2119 (info): Use log_host "$@" if function's $1 should mean script's $1. In vmtest.sh line 404: --control-port="${port}" 2>&1 | log_host & ^------^ SC2119 (info): Use log_host "$@" if function's $1 should mean script's $1. In vmtest.sh line 435: } ^-- SC1089 (error): Parsing stopped here. Is this keyword correctly matched up? For more information: https://www.shellcheck.net/wiki/SC2068 -- Double quote array expansions to ... https://www.shellcheck.net/wiki/SC2034 -- LOG_LEVEL_ERROR appears unused. V... https://www.shellcheck.net/wiki/SC2046 -- Quote this to prevent word splitt... ====== 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 26: readonly WAIT_TOTAL=$(( WAIT_PERIOD * WAIT_PERIOD_MAX )) ^--------^ SC2034 (warning): WAIT_TOTAL appears unused. Verify use (or export if used externally). 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 160: readonly LOG_LEVEL_ERROR=3 ^-------------^ SC2034 (warning): LOG_LEVEL_ERROR appears unused. Verify use (or export if used externally). In vmtest.sh line 251: ${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 265: pkill -SIGTERM -F "${pidfile}" 2>&1 > /dev/null ^--^ SC2069 (warning): To redirect stdout+stderr, 2>&1 must be last (or use '{ cmd > file; } 2>&1' to clarify). In vmtest.sh line 372: 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 378: if ! make -j$(nproc); then ^------^ SC2046 (warning): Quote this to prevent word splitting. In vmtest.sh line 382: 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 406: ${QEMU_OPTS} -device vhost-vsock-pci,guest-cid=${cid} \ ^----------^ SC2153 (info): Possible misspelling: QEMU_OPTS may not be assigned. Did you mean qemu_opts? 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 540: LOG_PREFIX=host log $@ ^-- SC2068 (error): Double quote array expansions to avoid re-splitting elements. In vmtest.sh line 543: log_guest() { ^-- SC2120 (warning): log_guest references arguments, but none are ever passed. In vmtest.sh line 544: LOG_PREFIX=guest log $@ ^-- SC2068 (error): Double quote array expansions to avoid re-splitting elements. In vmtest.sh line 564: 2>&1 | log_guest ^-------^ SC2119 (info): Use log_guest "$@" if function's $1 should mean script's $1. In vmtest.sh line 575: 2>&1 | log_guest & ^-------^ SC2119 (info): Use log_guest "$@" if function's $1 should mean script's $1. In vmtest.sh line 580: return $rc ^-^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$rc" In vmtest.sh line 588: return $rc ^-^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$rc" In vmtest.sh line 626: return $rc ^-^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$rc" In vmtest.sh line 634: return $rc ^-^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$rc" In vmtest.sh line 704: return $rc ^-^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$rc" In vmtest.sh line 799: return $KSFT_FAIL ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$KSFT_FAIL" In vmtest.sh line 813: return $KSFT_PASS ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$KSFT_PASS" In vmtest.sh line 816: return $KSFT_FAIL ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$KSFT_FAIL" In vmtest.sh line 849: return $KSFT_FAIL ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$KSFT_FAIL" In vmtest.sh line 878: 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 886: return $KSFT_FAIL ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$KSFT_FAIL" In vmtest.sh line 892: 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 920: return $KSFT_FAIL ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$KSFT_FAIL" In vmtest.sh line 934: return $KSFT_PASS ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$KSFT_PASS" In vmtest.sh line 937: return $KSFT_FAIL ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$KSFT_FAIL" In vmtest.sh line 963: 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 1167: 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 1189: 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 1201: vm_oops_cnt_after=$(vm_ssh none -- 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/SC2034 -- LOG_LEVEL_ERROR appears unused. V... https://www.shellcheck.net/wiki/SC2046 -- Quote this to prevent word splitt...