Commit 19e48a66 authored by Maciej Wawryk's avatar Maciej Wawryk Committed by Tomasz Zawadzki
Browse files

test: Shellcheck - correct rule: Iterating over ls



Correct shellcheck rule SC2045: Iterating over ls output is fragile. Use globs.

Signed-off-by: default avatarMaciej Wawryk <maciejx.wawryk@intel.com>
Change-Id: I436878774d6f86c23b1c5cf5220da297053f03e2
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/477397


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarPaul Luse <paul.e.luse@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
parent a291cb06
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -240,7 +240,7 @@ if hash shellcheck 2>/dev/null; then
	# go to: https://trello.com/c/29Z90j1W
	# Error descriptions can also be found at: https://github.com/koalaman/shellcheck/wiki
	# This SHCK_EXCLUDE list is out "to do" and we work to fix all of this errors.
	SHCK_EXCLUDE="SC2002,SC2010,SC2034,SC2045"
	SHCK_EXCLUDE="SC2002,SC2010,SC2034"
	# SPDK fails some error checks which have been deprecated in later versions of shellcheck.
	# We will not try to fix these error checks, but instead just leave the error types here
	# so that we can still run with older versions of shellcheck.
+1 −1
Original line number Diff line number Diff line
@@ -76,7 +76,7 @@ function install_iscsi_adm()
                git -C open-iscsi-install/open-iscsi config user.email none

                git -C open-iscsi-install/open-iscsi checkout 86e8892
                for patch in $(ls open-iscsi-install/patches); do
                for patch in open-iscsi-install/patches/*; do
                    git -C open-iscsi-install/open-iscsi am ../patches/$patch
                done
                sed -i '427s/.*/-1);/' open-iscsi-install/open-iscsi/usr/session_info.c
+2 −2
Original line number Diff line number Diff line
@@ -28,13 +28,13 @@ fi
$rpc_py bdev_get_bdevs
$rpc_py bdev_nvme_get_controllers

for ns in $(ls /dev/spdk/nvme?n?); do
for ns in /dev/spdk/nvme?n?; do
	${NVME_CMD} get-ns-id $ns
	${NVME_CMD} id-ns $ns
	${NVME_CMD} list-ns $ns
done

for ctrlr in $(ls /dev/spdk/nvme?); do
for ctrlr in /dev/spdk/nvme?; do
	${NVME_CMD} id-ctrl $ctrlr
	${NVME_CMD} list-ctrl $ctrlr
	${NVME_CMD} fw-log $ctrlr
+5 −3
Original line number Diff line number Diff line
@@ -131,9 +131,11 @@ function get_available_rdma_ips()

function get_rdma_if_list()
{
	for nic_type in $(ls /sys/class/infiniband); do
		for nic_name in $(ls /sys/class/infiniband/${nic_type}/device/net); do
			echo "$nic_name"
	for nic_type in /sys/class/infiniband/*; do
		[[ -e "$nic_type" ]] || break
		for nic_name in /sys/class/infiniband/"$(basename ${nic_type})"/device/net/*; do
			[[ -e "$nic_name" ]] || break
			basename "$nic_name"
		done
	done
}
+1 −1
Original line number Diff line number Diff line
@@ -1123,7 +1123,7 @@ function at_app_exit()
	# Kill vhost application
	notice "killing vhost app"

	for vhost_name in $(ls $TARGET_DIR); do
	for vhost_name in "$TARGET_DIR"/*; do
		vhost_kill $vhost_name
	done