ShellCheck - shell script analysis tool version: 0.11.0 license: GNU General Public License, version 3 website: https://www.shellcheck.net Redirect to /tmp/tmp.yv9Hks3LY5 and /tmp/tmp.pOzJLvn7zP Tree base: 1e64dd15d480 ("selftests/vsock: add tests for host <-> vm connectivity with namespaces") Now at: 5f719c92167a ("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 14: 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 15: readonly KERNEL_CHECKOUT=$(realpath "${SCRIPT_DIR}"/../../../../) ^-------------^ SC2155 (warning): Declare and assign separately to avoid masking return values. In vmtest.sh line 44: readonly LOG=$(mktemp /tmp/vsock_vmtest_XXXX.log) ^-^ SC2155 (warning): Declare and assign separately to avoid masking return values. In vmtest.sh line 209: init_namespaces() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 232: ns_set_mode() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 256: cleanup() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 363: 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 369: if ! make -j$(nproc); then ^------^ SC2046 (warning): Quote this to prevent word splitting. In vmtest.sh line 373: 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 401: terminate_pids() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 443: ${kernel_opt} \ ^-----------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: "${kernel_opt}" \ In vmtest.sh line 474: wait_for_listener() ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 498: vm_wait_for_listener() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 508: host_wait_for_listener() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 522: vm_dmesg_oops_count() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 528: vm_dmesg_warn_count() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 534: vm_dmesg_check() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 556: vm_vsock_test() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 583: return $rc ^-^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$rc" In vmtest.sh line 591: return $rc ^-^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$rc" In vmtest.sh line 594: host_vsock_test() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 624: return $rc ^-^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$rc" In vmtest.sh line 632: return $rc ^-^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$rc" In vmtest.sh line 666: log_guest() { ^-- SC2120 (warning): log_guest references arguments, but none are ever passed. ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 670: test_ns_host_vsock_ns_mode_ok() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 680: test_ns_diff_global_host_connect_to_global_vm_ok() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 732: test_ns_diff_global_host_connect_to_local_vm_fails() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 774: test_ns_diff_global_vm_connect_to_global_host_ok() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 835: test_ns_diff_global_vm_connect_to_local_host_fails() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 884: test_ns_diff_local_host_connect_to_local_vm_fails() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 927: test_ns_diff_local_vm_connect_to_local_host_fails() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 974: __test_loopback_two_netns() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 1002: test_ns_diff_global_to_local_loopback_local_fails() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 1012: test_ns_diff_local_to_global_loopback_fails() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 1022: test_ns_diff_local_to_local_loopback_fails() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 1032: test_ns_diff_global_to_global_loopback_ok() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 1042: test_ns_same_local_loopback_ok() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 1052: test_ns_same_local_host_connect_to_local_vm_ok() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 1088: test_ns_same_local_vm_connect_to_local_host_ok() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 1124: namespaces_can_boot_same_cid() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 1142: test_ns_global_same_cid_fails() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 1152: test_ns_local_global_same_cid_ok() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 1162: test_ns_global_local_same_cid_ok() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 1172: test_ns_local_same_cid_ok() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 1182: test_ns_host_vsock_ns_mode_write_once_ok() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 1198: test_vm_server_host_client() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 1210: test_vm_client_host_server() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 1222: test_vm_loopback() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 1239: test_ns_vm_local_mode_rejected() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 1322: 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 1334: 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/SC2046 -- Quote this to prevent word splitt... https://www.shellcheck.net/wiki/SC2120 -- log_guest references arguments, b... https://www.shellcheck.net/wiki/SC2155 -- Declare and assign separately to ... ====== Checking the tree with the patch ====== Checking tools/testing/selftests/vsock/vmtest.sh - 3bbe24ed85577bc751e7e913126d8b44bb8554cc21519ace46c3118b1749f848 In vmtest.sh line 14: 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 15: readonly KERNEL_CHECKOUT=$(realpath "${SCRIPT_DIR}"/../../../../) ^-------------^ SC2155 (warning): Declare and assign separately to avoid masking return values. In vmtest.sh line 44: readonly LOG=$(mktemp /tmp/vsock_vmtest_XXXX.log) ^-^ SC2155 (warning): Declare and assign separately to avoid masking return values. In vmtest.sh line 233: init_namespaces() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 256: ns_set_mode() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 280: cleanup() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 387: 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 393: if ! make -j$(nproc); then ^------^ SC2046 (warning): Quote this to prevent word splitting. In vmtest.sh line 397: 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 425: terminate_pids() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 467: ${kernel_opt} \ ^-----------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: "${kernel_opt}" \ In vmtest.sh line 498: wait_for_listener() ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 522: vm_wait_for_listener() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 532: host_wait_for_listener() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 546: vm_dmesg_oops_count() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 552: vm_dmesg_warn_count() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 558: vm_dmesg_check() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 580: vm_vsock_test() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 607: return $rc ^-^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$rc" In vmtest.sh line 615: return $rc ^-^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$rc" In vmtest.sh line 618: host_vsock_test() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 648: return $rc ^-^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$rc" In vmtest.sh line 656: return $rc ^-^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$rc" In vmtest.sh line 690: log_guest() { ^-- SC2120 (warning): log_guest references arguments, but none are ever passed. ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 694: test_ns_host_vsock_ns_mode_ok() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 704: test_ns_diff_global_host_connect_to_global_vm_ok() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 756: test_ns_diff_global_host_connect_to_local_vm_fails() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 798: test_ns_diff_global_vm_connect_to_global_host_ok() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 859: test_ns_diff_global_vm_connect_to_local_host_fails() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 908: test_ns_diff_local_host_connect_to_local_vm_fails() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 951: test_ns_diff_local_vm_connect_to_local_host_fails() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 998: __test_loopback_two_netns() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 1026: test_ns_diff_global_to_local_loopback_local_fails() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 1036: test_ns_diff_local_to_global_loopback_fails() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 1046: test_ns_diff_local_to_local_loopback_fails() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 1056: test_ns_diff_global_to_global_loopback_ok() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 1066: test_ns_same_local_loopback_ok() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 1076: test_ns_same_local_host_connect_to_local_vm_ok() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 1112: test_ns_same_local_vm_connect_to_local_host_ok() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 1148: namespaces_can_boot_same_cid() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 1166: test_ns_global_same_cid_fails() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 1176: test_ns_local_global_same_cid_ok() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 1186: test_ns_global_local_same_cid_ok() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 1196: test_ns_local_same_cid_ok() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 1206: test_ns_host_vsock_ns_mode_write_once_ok() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 1222: test_vm_server_host_client() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 1234: test_vm_client_host_server() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 1246: test_vm_loopback() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 1263: test_ns_vm_local_mode_rejected() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 1283: check_ns_changes_dont_break_connection() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 1358: test_ns_mode_change_connection_continue_vm_ok() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 1362: test_ns_mode_change_connection_continue_host_ok() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 1366: test_ns_mode_change_connection_continue_both_ok() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 1370: test_ns_delete_vm_ok() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 1374: test_ns_delete_host_ok() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 1378: test_ns_delete_both_ok() { ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly). In vmtest.sh line 1445: 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 1457: 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/SC2046 -- Quote this to prevent word splitt... https://www.shellcheck.net/wiki/SC2120 -- log_guest references arguments, b... https://www.shellcheck.net/wiki/SC2155 -- Declare and assign separately to ...