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.HHAM3B1e7X and /tmp/tmp.GhWQ2d4hAg Tree base: 467deeed0935 ("net: netdevsim: Support setting dev->perm_addr on port creation") Now at: 5677c4955f89 ("selftests: net: add netdev-l2addr.sh for testing L2 address functionality") ====== Checking before the patch ====== Checking tools/testing/selftests/net/lib.sh - c03467c29b10bc5091e0c288a3bb791664845bf18d1bc2e796311e58cd726204 In lib.sh line 78: local start_time="$(date -u +%s%3N)" ^--------^ SC2155 (warning): Declare and assign separately to avoid masking return values. In lib.sh line 87: local current_time="$(date -u +%s%3N)" ^----------^ SC2155 (warning): Declare and assign separately to avoid masking return values. In lib.sh line 115: local current=$("$@") ^-----^ SC2155 (warning): Declare and assign separately to avoid masking return values. In lib.sh line 118: ((current $expr)) ^-- SC1105 (error): Shells disambiguate (( differently or not at all. For subshell, add spaces around ( . For ((, fix parsing errors. ^---^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: ((current "$expr")) In lib.sh line 126: local base=$("$@") ^--^ SC2155 (warning): Declare and assign separately to avoid masking return values. In lib.sh line 135: local base=$("$@") ^--^ SC2155 (warning): Declare and assign separately to avoid masking return values. In lib.sh line 145: if ! which $prog_name >/dev/null 2>/dev/null; then ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: if ! which "$prog_name" >/dev/null 2>/dev/null; then In lib.sh line 147: if ! which $prog_name >/dev/null; then ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: if ! which "$prog_name" >/dev/null; then In lib.sh line 235: echo "$id 1" | ip netns exec $ns tee /sys/bus/netdevsim/new_device >/dev/null ^-^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: echo "$id 1" | ip netns exec "$ns" tee /sys/bus/netdevsim/new_device >/dev/null In lib.sh line 236: local dev=$(ip netns exec $ns ls /sys/bus/netdevsim/devices/netdevsim$id/net) ^-^ SC2155 (warning): Declare and assign separately to avoid masking return values. ^-^ SC2086 (info): Double quote to prevent globbing and word splitting. ^-^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: local dev=$(ip netns exec "$ns" ls /sys/bus/netdevsim/devices/netdevsim"$id"/net) In lib.sh line 237: ip -netns $ns link set dev $dev name nsim$id ^-^ 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: ip -netns "$ns" link set dev "$dev" name nsim"$id" In lib.sh line 238: ip -netns $ns link set dev nsim$id up ^-^ SC2086 (info): Double quote to prevent globbing and word splitting. ^-^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: ip -netns "$ns" link set dev nsim"$id" up In lib.sh line 240: echo nsim$id ^-^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: echo nsim"$id" In lib.sh line 259: tc -j -s filter show dev $dev $dir pref $pref \ ^--^ 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: tc -j -s filter show dev "$dev" "$dir" pref "$pref" \ In lib.sh line 270: tc $netns -j -s filter show $id \ ^----^ SC2086 (info): Double quote to prevent globbing and word splitting. ^-^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: tc "$netns" -j -s filter show "$id" \ In lib.sh line 282: tc -n $ns qdisc add dev $dev root handle 1: prio bands 2 \ ^-^ SC2086 (info): Double quote to prevent globbing and word splitting. ^--^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: tc -n "$ns" qdisc add dev "$dev" root handle 1: prio bands 2 \ In lib.sh line 285: tc -n $ns qdisc add dev $dev parent 1:1 handle 11: pfifo ^-^ SC2086 (info): Double quote to prevent globbing and word splitting. ^--^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: tc -n "$ns" qdisc add dev "$dev" parent 1:1 handle 11: pfifo In lib.sh line 286: tc -n $ns qdisc add dev $dev parent 1:2 handle 12: pfifo ^-^ SC2086 (info): Double quote to prevent globbing and word splitting. ^--^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: tc -n "$ns" qdisc add dev "$dev" parent 1:2 handle 12: pfifo In lib.sh line 288: tc -n $ns filter add dev $dev parent 1: protocol ipv$ipver \ ^-^ 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: tc -n "$ns" filter add dev "$dev" parent 1: protocol ipv"$ipver" \ In lib.sh line 289: flower $flower_expr classid 1:2 ^----------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: flower "$flower_expr" classid 1:2 In lib.sh line 296: tc -n $ns -j -s qdisc show dev $dev handle 12: | jq .[0].packets ^-^ SC2086 (info): Double quote to prevent globbing and word splitting. ^--^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: tc -n "$ns" -j -s qdisc show dev "$dev" handle 12: | jq .[0].packets In lib.sh line 304: RET=$(ksft_status_merge $RET $ksft_status) ^----------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: RET=$(ksft_status_merge $RET "$ksft_status") In lib.sh line 305: if (( $? )); then ^-- SC2181 (style): Check exit code directly with e.g. 'if ! mycmd;', not indirectly with $?. In lib.sh line 327: read a ^--^ SC2162 (info): read without -r will mangle backslashes. In lib.sh line 385: EXIT_STATUS=$(ksft_exit_status_merge $EXIT_STATUS $RET) ^--^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: EXIT_STATUS=$(ksft_exit_status_merge $EXIT_STATUS "$RET") In lib.sh line 386: return $RET ^--^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$RET" In lib.sh line 391: RET=$ksft_skip retmsg= log_test "$@" ^-- SC1007 (warning): Remove space after = if trying to assign a value (for empty string, use var='' ... ). In lib.sh line 396: RET=$ksft_xfail retmsg= log_test "$@" ^-- SC1007 (warning): Remove space after = if trying to assign a value (for empty string, use var='' ... ). In lib.sh line 412: $current_test ^-----------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: "$current_test" In lib.sh line 448: check_fail $err "$what succeeded, but should have failed" ^--^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: check_fail "$err" "$what succeeded, but should have failed" In lib.sh line 450: check_err $err "$what failed" ^--^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: check_err "$err" "$what failed" In lib.sh line 480: kind=$(ip -j -d link show dev $dev | ^--^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: kind=$(ip -j -d link show dev "$dev" | In lib.sh line 493: ip -j link show dev $if_name | jq -r '.[]["address"]' ^------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: ip -j link show dev "$if_name" | jq -r '.[]["address"]' In lib.sh line 501: { kill $pid && wait $pid; } 2>/dev/null ^--^ SC2086 (info): Double quote to prevent globbing and word splitting. ^--^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: { kill "$pid" && wait "$pid"; } 2>/dev/null In lib.sh line 510: return $EXIT_STATUS ^----------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$EXIT_STATUS" In lib.sh line 519: exit $EXIT_STATUS ^----------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: exit "$EXIT_STATUS" In lib.sh line 545: local old_addr=$(mac_get "$name") ^------^ SC2155 (warning): Declare and assign separately to avoid masking return values. In lib.sh line 555: local state=$(ip -j link show "$name" | ^---^ SC2155 (warning): Declare and assign separately to avoid masking return values. In lib.sh line 616: [ ${protocol} = "tcp" ] && pattern="${pattern}0A" ^---------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: [ "${protocol}" = "tcp" ] && pattern="${pattern}0A" In lib.sh line 618: if ip netns exec "${listener_ns}" awk '{print $2" "$4}' \ ^---------------^ SC2016 (info): Expressions don't expand in single quotes, use double quotes for that. For more information: https://www.shellcheck.net/wiki/SC1105 -- Shells disambiguate (( differentl... https://www.shellcheck.net/wiki/SC1007 -- Remove space after = if trying to... https://www.shellcheck.net/wiki/SC2155 -- Declare and assign separately to ... ====== Checking the tree with the patch ====== Checking tools/testing/selftests/net/lib.sh - c03467c29b10bc5091e0c288a3bb791664845bf18d1bc2e796311e58cd726204 In lib.sh line 78: local start_time="$(date -u +%s%3N)" ^--------^ SC2155 (warning): Declare and assign separately to avoid masking return values. In lib.sh line 87: local current_time="$(date -u +%s%3N)" ^----------^ SC2155 (warning): Declare and assign separately to avoid masking return values. In lib.sh line 115: local current=$("$@") ^-----^ SC2155 (warning): Declare and assign separately to avoid masking return values. In lib.sh line 118: ((current $expr)) ^-- SC1105 (error): Shells disambiguate (( differently or not at all. For subshell, add spaces around ( . For ((, fix parsing errors. ^---^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: ((current "$expr")) In lib.sh line 126: local base=$("$@") ^--^ SC2155 (warning): Declare and assign separately to avoid masking return values. In lib.sh line 135: local base=$("$@") ^--^ SC2155 (warning): Declare and assign separately to avoid masking return values. In lib.sh line 145: if ! which $prog_name >/dev/null 2>/dev/null; then ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: if ! which "$prog_name" >/dev/null 2>/dev/null; then In lib.sh line 147: if ! which $prog_name >/dev/null; then ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: if ! which "$prog_name" >/dev/null; then In lib.sh line 235: echo "$id 1" | ip netns exec $ns tee /sys/bus/netdevsim/new_device >/dev/null ^-^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: echo "$id 1" | ip netns exec "$ns" tee /sys/bus/netdevsim/new_device >/dev/null In lib.sh line 236: local dev=$(ip netns exec $ns ls /sys/bus/netdevsim/devices/netdevsim$id/net) ^-^ SC2155 (warning): Declare and assign separately to avoid masking return values. ^-^ SC2086 (info): Double quote to prevent globbing and word splitting. ^-^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: local dev=$(ip netns exec "$ns" ls /sys/bus/netdevsim/devices/netdevsim"$id"/net) In lib.sh line 237: ip -netns $ns link set dev $dev name nsim$id ^-^ 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: ip -netns "$ns" link set dev "$dev" name nsim"$id" In lib.sh line 238: ip -netns $ns link set dev nsim$id up ^-^ SC2086 (info): Double quote to prevent globbing and word splitting. ^-^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: ip -netns "$ns" link set dev nsim"$id" up In lib.sh line 240: echo nsim$id ^-^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: echo nsim"$id" In lib.sh line 282: tc -j -s filter show dev $dev $dir pref $pref \ ^--^ 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: tc -j -s filter show dev "$dev" "$dir" pref "$pref" \ In lib.sh line 293: tc $netns -j -s filter show $id \ ^----^ SC2086 (info): Double quote to prevent globbing and word splitting. ^-^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: tc "$netns" -j -s filter show "$id" \ In lib.sh line 305: tc -n $ns qdisc add dev $dev root handle 1: prio bands 2 \ ^-^ SC2086 (info): Double quote to prevent globbing and word splitting. ^--^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: tc -n "$ns" qdisc add dev "$dev" root handle 1: prio bands 2 \ In lib.sh line 308: tc -n $ns qdisc add dev $dev parent 1:1 handle 11: pfifo ^-^ SC2086 (info): Double quote to prevent globbing and word splitting. ^--^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: tc -n "$ns" qdisc add dev "$dev" parent 1:1 handle 11: pfifo In lib.sh line 309: tc -n $ns qdisc add dev $dev parent 1:2 handle 12: pfifo ^-^ SC2086 (info): Double quote to prevent globbing and word splitting. ^--^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: tc -n "$ns" qdisc add dev "$dev" parent 1:2 handle 12: pfifo In lib.sh line 311: tc -n $ns filter add dev $dev parent 1: protocol ipv$ipver \ ^-^ 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: tc -n "$ns" filter add dev "$dev" parent 1: protocol ipv"$ipver" \ In lib.sh line 312: flower $flower_expr classid 1:2 ^----------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: flower "$flower_expr" classid 1:2 In lib.sh line 319: tc -n $ns -j -s qdisc show dev $dev handle 12: | jq .[0].packets ^-^ SC2086 (info): Double quote to prevent globbing and word splitting. ^--^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: tc -n "$ns" -j -s qdisc show dev "$dev" handle 12: | jq .[0].packets In lib.sh line 327: RET=$(ksft_status_merge $RET $ksft_status) ^----------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: RET=$(ksft_status_merge $RET "$ksft_status") In lib.sh line 328: if (( $? )); then ^-- SC2181 (style): Check exit code directly with e.g. 'if ! mycmd;', not indirectly with $?. In lib.sh line 350: read a ^--^ SC2162 (info): read without -r will mangle backslashes. In lib.sh line 408: EXIT_STATUS=$(ksft_exit_status_merge $EXIT_STATUS $RET) ^--^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: EXIT_STATUS=$(ksft_exit_status_merge $EXIT_STATUS "$RET") In lib.sh line 409: return $RET ^--^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$RET" In lib.sh line 414: RET=$ksft_skip retmsg= log_test "$@" ^-- SC1007 (warning): Remove space after = if trying to assign a value (for empty string, use var='' ... ). In lib.sh line 419: RET=$ksft_xfail retmsg= log_test "$@" ^-- SC1007 (warning): Remove space after = if trying to assign a value (for empty string, use var='' ... ). In lib.sh line 435: $current_test ^-----------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: "$current_test" In lib.sh line 471: check_fail $err "$what succeeded, but should have failed" ^--^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: check_fail "$err" "$what succeeded, but should have failed" In lib.sh line 473: check_err $err "$what failed" ^--^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: check_err "$err" "$what failed" In lib.sh line 503: kind=$(ip -j -d link show dev $dev | ^--^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: kind=$(ip -j -d link show dev "$dev" | In lib.sh line 516: ip -j link show dev $if_name | jq -r '.[]["address"]' ^------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: ip -j link show dev "$if_name" | jq -r '.[]["address"]' In lib.sh line 524: { kill $pid && wait $pid; } 2>/dev/null ^--^ SC2086 (info): Double quote to prevent globbing and word splitting. ^--^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: { kill "$pid" && wait "$pid"; } 2>/dev/null In lib.sh line 533: return $EXIT_STATUS ^----------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: return "$EXIT_STATUS" In lib.sh line 542: exit $EXIT_STATUS ^----------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: exit "$EXIT_STATUS" In lib.sh line 568: local old_addr=$(mac_get "$name") ^------^ SC2155 (warning): Declare and assign separately to avoid masking return values. In lib.sh line 578: local state=$(ip -j link show "$name" | ^---^ SC2155 (warning): Declare and assign separately to avoid masking return values. In lib.sh line 639: [ ${protocol} = "tcp" ] && pattern="${pattern}0A" ^---------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: [ "${protocol}" = "tcp" ] && pattern="${pattern}0A" In lib.sh line 641: if ip netns exec "${listener_ns}" awk '{print $2" "$4}' \ ^---------------^ SC2016 (info): Expressions don't expand in single quotes, use double quotes for that. For more information: https://www.shellcheck.net/wiki/SC1105 -- Shells disambiguate (( differentl... https://www.shellcheck.net/wiki/SC1007 -- Remove space after = if trying to... https://www.shellcheck.net/wiki/SC2155 -- Declare and assign separately to ... Checking tools/testing/selftests/net/netdev-l2addr.sh - f55d020e64818fa89b0a4b9ac0c8beb1b37984bb816455a45321df839246135a tools/testing/selftests/net/netdev-l2addr.sh is shellcheck compliant