========== shellcheck - FAILED ====== Checking before the patch ====== ====== Checking the tree with the patch ====== tools/testing/selftests/bpf/test_bpftool_map.sh is a new file, but not shellcheck compliant New warnings added New errors added --- /tmp/tmp.XjAZ3ojMuc 2025-06-11 15:45:01.229632429 -0700 +++ /tmp/tmp.YW2qRF8Yxj 2025-06-11 15:45:01.737629535 -0700 @@ -0,0 +1,379 @@ + +In test_bpftool_map.sh line 18: +SCRIPT_DIR=$(dirname $(realpath "$0")) + ^--------------^ SC2046 (warning): Quote this to prevent word splitting. + + +In test_bpftool_map.sh line 23: +KDIR_ROOT_DIR=$(realpath "$SCRIPT_DIR"/../../../../) +^-----------^ SC2034 (warning): KDIR_ROOT_DIR appears unused. Verify use (or export if used externally). + + +In test_bpftool_map.sh line 27: + set +eu + ^-----^ SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly). + + +In test_bpftool_map.sh line 30: + [ -d "$BPF_DIR" ] && rm -rf "$BPF_DIR" 2> /dev/null + ^----------------^ SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly). + ^----------------------------^ SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly). + + +In test_bpftool_map.sh line 33: + if [ "$BPF_FS_PARENT" = "$BPF_FS_TMP_PARENT" ]; then + ^-- SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly). + ^-- SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly). + + +In test_bpftool_map.sh line 38: + max_attempts=3 + ^------------^ SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly). + + +In test_bpftool_map.sh line 39: + attempt=0 + ^-------^ SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly). + + +In test_bpftool_map.sh line 40: + while mountpoint -q "$BPF_DIR" && [ $attempt -lt $max_attempts ]; do + ^-- SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly). + ^-----------------------^ SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly). + ^----------------------------^ SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly). + ^------^ SC2086 (info): Double quote to prevent globbing and word splitting. + ^-----------^ SC2086 (info): Double quote to prevent globbing and word splitting. + +Did you mean: + while mountpoint -q "$BPF_DIR" && [ "$attempt" -lt "$max_attempts" ]; do + + +In test_bpftool_map.sh line 41: + umount -R "$BPF_DIR" 2>/dev/null + ^-- SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly). + + +In test_bpftool_map.sh line 42: + attempt=$((attempt+1)) + ^--------------------^ SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly). + + +In test_bpftool_map.sh line 46: + [ -d "$BPF_DIR" ] && rm -rf "$BPF_DIR" 2>/dev/null + ^----------------^ SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly). + ^---------------------------^ SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly). + + +In test_bpftool_map.sh line 52: + echo "selftests: $TESTNAME [SKIP]" + ^-- SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly). + + +In test_bpftool_map.sh line 53: + _cleanup + ^------^ SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly). + + +In test_bpftool_map.sh line 55: + exit $ksft_skip + ^-------------^ SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly). + ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. + +Did you mean: + exit "$ksft_skip" + + +In test_bpftool_map.sh line 60: + if [ "$?" = 0 ]; then + ^-- SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly). + ^----------^ SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly). + + +In test_bpftool_map.sh line 61: + echo "selftests: $TESTNAME [PASS]" + ^-- SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly). + + +In test_bpftool_map.sh line 63: + echo "selftests: $TESTNAME [FAILED]" + ^-- SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly). + + +In test_bpftool_map.sh line 65: + _cleanup + ^------^ SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly). + + +In test_bpftool_map.sh line 69: + if [ $(id -u) -ne 0 ]; then + ^------^ SC2046 (warning): Quote this to prevent word splitting. + + +In test_bpftool_map.sh line 79: + local bpftool_path="$1" + ^----------------^ SC3043 (warning): In POSIX sh, 'local' is undefined. + + +In test_bpftool_map.sh line 91: + local map_name="$1" + ^------------^ SC3043 (warning): In POSIX sh, 'local' is undefined. + + +In test_bpftool_map.sh line 92: + local bpftool_path="$2" + ^----------------^ SC3043 (warning): In POSIX sh, 'local' is undefined. + + +In test_bpftool_map.sh line 106: + local name_cmd="$1" + ^------------^ SC3043 (warning): In POSIX sh, 'local' is undefined. + + +In test_bpftool_map.sh line 107: + local map_name="$2" + ^------------^ SC3043 (warning): In POSIX sh, 'local' is undefined. + + +In test_bpftool_map.sh line 108: + local bpftool_path="$3" + ^----------------^ SC3043 (warning): In POSIX sh, 'local' is undefined. + + +In test_bpftool_map.sh line 109: + local key="$4" + ^-------^ SC3043 (warning): In POSIX sh, 'local' is undefined. + + +In test_bpftool_map.sh line 112: + if ! "$bpftool_path" map lookup "$name_cmd" "$map_name" key $key 1>/dev/null; then + ^--^ SC2086 (info): Double quote to prevent globbing and word splitting. + +Did you mean: + if ! "$bpftool_path" map lookup "$name_cmd" "$map_name" key "$key" 1>/dev/null; then + + +In test_bpftool_map.sh line 126: + local name_cmd="$1" + ^------------^ SC3043 (warning): In POSIX sh, 'local' is undefined. + + +In test_bpftool_map.sh line 127: + local map_name="$2" + ^------------^ SC3043 (warning): In POSIX sh, 'local' is undefined. + + +In test_bpftool_map.sh line 128: + local bpftool_path="$3" + ^----------------^ SC3043 (warning): In POSIX sh, 'local' is undefined. + + +In test_bpftool_map.sh line 129: + local key="$4" + ^-------^ SC3043 (warning): In POSIX sh, 'local' is undefined. + + +In test_bpftool_map.sh line 130: + local write_should_succeed="$5" + ^------------------------^ SC3043 (warning): In POSIX sh, 'local' is undefined. + + +In test_bpftool_map.sh line 131: + local value="1 1 1 1" + ^---------^ SC3043 (warning): In POSIX sh, 'local' is undefined. + + +In test_bpftool_map.sh line 133: + if "$bpftool_path" map update "$name_cmd" "$map_name" key $key value $value 2>/dev/null; then + ^--^ SC2086 (info): Double quote to prevent globbing and word splitting. + ^----^ SC2086 (info): Double quote to prevent globbing and word splitting. + +Did you mean: + if "$bpftool_path" map update "$name_cmd" "$map_name" key "$key" value "$value" 2>/dev/null; then + + +In test_bpftool_map.sh line 154: + local name_cmd="$1" + ^------------^ SC3043 (warning): In POSIX sh, 'local' is undefined. + + +In test_bpftool_map.sh line 155: + local map_name="$2" + ^------------^ SC3043 (warning): In POSIX sh, 'local' is undefined. + + +In test_bpftool_map.sh line 156: + local bpftool_path="$3" + ^----------------^ SC3043 (warning): In POSIX sh, 'local' is undefined. + + +In test_bpftool_map.sh line 157: + local key="$4" + ^-------^ SC3043 (warning): In POSIX sh, 'local' is undefined. + + +In test_bpftool_map.sh line 158: + local write_should_succeed="$5" + ^------------------------^ SC3043 (warning): In POSIX sh, 'local' is undefined. + + +In test_bpftool_map.sh line 159: + local value="1 1 1 1" + ^---------^ SC3043 (warning): In POSIX sh, 'local' is undefined. + + +In test_bpftool_map.sh line 163: + if ! "$bpftool_path" map lookup "$name_cmd" "$map_name" key $key 1>/dev/null; then + ^--^ SC2086 (info): Double quote to prevent globbing and word splitting. + +Did you mean: + if ! "$bpftool_path" map lookup "$name_cmd" "$map_name" key "$key" 1>/dev/null; then + + +In test_bpftool_map.sh line 169: + if "$bpftool_path" map delete "$name_cmd" "$map_name" key $key 2>/dev/null; then + ^--^ SC2086 (info): Double quote to prevent globbing and word splitting. + +Did you mean: + if "$bpftool_path" map delete "$name_cmd" "$map_name" key "$key" 2>/dev/null; then + + +In test_bpftool_map.sh line 182: + if "$bpftool_path" map lookup "$name_cmd" "$map_name" key $key 1>/dev/null; then + ^--^ SC2086 (info): Double quote to prevent globbing and word splitting. + +Did you mean: + if "$bpftool_path" map lookup "$name_cmd" "$map_name" key "$key" 1>/dev/null; then + + +In test_bpftool_map.sh line 196: + if "$bpftool_path" map update "$name_cmd" "$map_name" key $key value $value 2>/dev/null; then + ^--^ SC2086 (info): Double quote to prevent globbing and word splitting. + ^----^ SC2086 (info): Double quote to prevent globbing and word splitting. + +Did you mean: + if "$bpftool_path" map update "$name_cmd" "$map_name" key "$key" value "$value" 2>/dev/null; then + + +In test_bpftool_map.sh line 217: + local name_cmd="$1" + ^------------^ SC3043 (warning): In POSIX sh, 'local' is undefined. + + +In test_bpftool_map.sh line 218: + local map_name="$2" + ^------------^ SC3043 (warning): In POSIX sh, 'local' is undefined. + + +In test_bpftool_map.sh line 219: + local bpftool_path="$3" + ^----------------^ SC3043 (warning): In POSIX sh, 'local' is undefined. + + +In test_bpftool_map.sh line 220: + local bpf_dir="$4" + ^-----------^ SC3043 (warning): In POSIX sh, 'local' is undefined. + + +In test_bpftool_map.sh line 221: + local bpf_file="$5" + ^------------^ SC3043 (warning): In POSIX sh, 'local' is undefined. + + +In test_bpftool_map.sh line 222: + local pin_path="$bpf_dir/map_iterator" + ^------------^ SC3043 (warning): In POSIX sh, 'local' is undefined. + + +In test_bpftool_map.sh line 245: + local name_cmd="$1" + ^------------^ SC3043 (warning): In POSIX sh, 'local' is undefined. + + +In test_bpftool_map.sh line 246: + local map_name="$2" + ^------------^ SC3043 (warning): In POSIX sh, 'local' is undefined. + + +In test_bpftool_map.sh line 247: + local bpftool_path="$3" + ^----------------^ SC3043 (warning): In POSIX sh, 'local' is undefined. + + +In test_bpftool_map.sh line 248: + local key_for_rw="$4" + ^--------------^ SC3043 (warning): In POSIX sh, 'local' is undefined. + + +In test_bpftool_map.sh line 249: + local key_to_del="$5" + ^--------------^ SC3043 (warning): In POSIX sh, 'local' is undefined. + + +In test_bpftool_map.sh line 250: + local write_should_succeed="$6" + ^------------------------^ SC3043 (warning): In POSIX sh, 'local' is undefined. + + +In test_bpftool_map.sh line 251: + local bpf_dir="$7" + ^-----------^ SC3043 (warning): In POSIX sh, 'local' is undefined. + + +In test_bpftool_map.sh line 252: + local bpf_iter_file_path="$8" + ^----------------------^ SC3043 (warning): In POSIX sh, 'local' is undefined. + + +In test_bpftool_map.sh line 271: + local map_name="$1" + ^------------^ SC3043 (warning): In POSIX sh, 'local' is undefined. + + +In test_bpftool_map.sh line 272: + local bpftool_path="$2" + ^----------------^ SC3043 (warning): In POSIX sh, 'local' is undefined. + + +In test_bpftool_map.sh line 273: + local bpf_dir="$3" + ^-----------^ SC3043 (warning): In POSIX sh, 'local' is undefined. + + +In test_bpftool_map.sh line 274: + local pin_path="$bpf_dir/${map_name}_pinned" + ^------------^ SC3043 (warning): In POSIX sh, 'local' is undefined. + + +In test_bpftool_map.sh line 275: + local write_should_succeed="$4" + ^------------------------^ SC3043 (warning): In POSIX sh, 'local' is undefined. + + +In test_bpftool_map.sh line 276: + local bpf_iter_file_path="$5" + ^----------------------^ SC3043 (warning): In POSIX sh, 'local' is undefined. + + +In test_bpftool_map.sh line 299: + local bpftool_path="$1" + ^----------------^ SC3043 (warning): In POSIX sh, 'local' is undefined. + + +In test_bpftool_map.sh line 300: + local bpf_dir="$2" + ^-----------^ SC3043 (warning): In POSIX sh, 'local' is undefined. + + +In test_bpftool_map.sh line 301: + local outer_map_name="outer_map_tt" + ^------------------^ SC3043 (warning): In POSIX sh, 'local' is undefined. + + +In test_bpftool_map.sh line 302: + local inner_map_name="inner_map_tt" + ^------------------^ SC3043 (warning): In POSIX sh, 'local' is undefined. + +For more information: + https://www.shellcheck.net/wiki/SC2034 -- KDIR_ROOT_DIR appears unused. Ver... + https://www.shellcheck.net/wiki/SC2046 -- Quote this to prevent word splitt... + https://www.shellcheck.net/wiki/SC3043 -- In POSIX sh, 'local' is undefined.