From 8c176db2ca60e2e51ef331ce5290f22d72e13420 Mon Sep 17 00:00:00 2001 From: Michal Berger Date: Thu, 24 Jun 2021 15:56:37 +0200 Subject: [PATCH] check_format: Fixes for shellcheck's SC2030 directive SC2030: Modification of var is local (to subshell caused by pipeline) This directive is raised since the for loop (or rather its contents) is piped through to another process. In this context it's not harmful since we are interested only in sending the stdout but since we operate on variables that happen to be local to the process that handles the loop shellcheck sees that as a potential issue. To make it happy remove the pipe and sort pci addresses prior running the loop. Signed-off-by: Michal Berger Change-Id: I835c5ac1da9012129c5d01d62880307f70caab1b Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8501 Community-CI: Mellanox Build Bot Reviewed-by: Karol Latecki Reviewed-by: Ben Walker Reviewed-by: Jim Harris Tested-by: SPDK CI Jenkins --- scripts/setup.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/setup.sh b/scripts/setup.sh index 4d2346424..18c02c1e8 100755 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -581,7 +581,9 @@ function status_linux() { printf '\n%-8s %-15s %-6s %-6s %-7s %-16s %-10s %s\n' \ "Type" "BDF" "Vendor" "Device" "NUMA" "Driver" "Device" "Block devices" >&2 - for bdf in "${!all_devices_d[@]}"; do + sorted_bdfs=($(printf '%s\n' "${!all_devices_d[@]}" | sort)) + + for bdf in "${sorted_bdfs[@]}"; do driver=${drivers_d["$bdf"]} if [ "$numa_nodes" = "0" ]; then node="-" @@ -613,7 +615,7 @@ function status_linux() { printf '%-8s %-15s %-6s %-6s %-7s %-16s %-10s %s\n' \ "$desc" "$bdf" "${pci_ids_vendor["$bdf"]#0x}" "${pci_ids_device["$bdf"]#0x}" \ "$node" "${driver:--}" "${name:-}" "${blknames[*]:--}" - done | sort -bk2,2 + done } function status_freebsd() {