From c9c576912d779a0bdad1fbf8fa32ee4f92568050 Mon Sep 17 00:00:00 2001 From: Pawel Kaminski Date: Mon, 21 Oct 2019 06:14:41 -0400 Subject: [PATCH] test: Shellcheck - move rule SC2162 to exception list read without -r will mangle backslashes Change-Id: I9eb59dce40c0bfb59d865319992b419d512dc41b Signed-off-by: Pawel Kaminski Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471885 Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Shuhei Matsumoto --- scripts/check_format.sh | 3 +-- test/ftl/ftl.sh | 2 +- test/json_config/json_config.sh | 2 +- test/vhost/common.sh | 2 +- test/vhost/fiotest/fio.sh | 2 +- 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/scripts/check_format.sh b/scripts/check_format.sh index a64a24603..24be8c654 100755 --- a/scripts/check_format.sh +++ b/scripts/check_format.sh @@ -243,8 +243,7 @@ if hash shellcheck 2>/dev/null; then SHCK_EXCLUDE="SC1083,SC2002,\ SC2010,SC2012,SC2016,SC2034,SC2045,SC2046,SC2068,SC2086,SC2089,SC2090,\ SC2097,SC2098,SC2119,SC2120,SC2128,\ -SC2129,SC2140,SC2142,SC2143,SC2154,SC2155,\ -SC2162" +SC2129,SC2140,SC2142,SC2143,SC2154,SC2155" # 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. diff --git a/test/ftl/ftl.sh b/test/ftl/ftl.sh index 858cf56e3..1e0734dd5 100755 --- a/test/ftl/ftl.sh +++ b/test/ftl/ftl.sh @@ -12,7 +12,7 @@ function at_ftl_exit() { PCI_WHITELIST="$device" PCI_BLACKLIST="" DRIVER_OVERRIDE="$ocssd_original_dirver" ./scripts/setup.sh } -read device _ <<< "$OCSSD_PCI_DEVICES" +read -r device _ <<< "$OCSSD_PCI_DEVICES" if [[ -z "$device" ]]; then echo "OCSSD device list is empty." diff --git a/test/json_config/json_config.sh b/test/json_config/json_config.sh index 29881adb1..ee8c50fd3 100755 --- a/test/json_config/json_config.sh +++ b/test/json_config/json_config.sh @@ -62,7 +62,7 @@ function tgt_check_notifications() { local event_line event ev_type ev_ctx local rc="" - while read event_line; do + while read -r event_line; do # remove ID event="${event_line%:*}" diff --git a/test/vhost/common.sh b/test/vhost/common.sh index 2948cd756..4048a9aa9 100644 --- a/test/vhost/common.sh +++ b/test/vhost/common.sh @@ -32,7 +32,7 @@ function vhosttestinit() if [[ ! -f $VM_IMAGE ]]; then echo "VM image not found at $VM_IMAGE" echo "Download to $HOME? [yn]" - read download + read -r download if [ "$download" = "y" ]; then curl https://dqtibwqq6s6ux.cloudfront.net/download/test_resources/vhost_vm_image.tar.gz | tar xz -C $HOME fi diff --git a/test/vhost/fiotest/fio.sh b/test/vhost/fiotest/fio.sh index 4ebb1ea8a..23ac9ef8c 100755 --- a/test/vhost/fiotest/fio.sh +++ b/test/vhost/fiotest/fio.sh @@ -206,7 +206,7 @@ for vm_num in $used_vms; do done if $dry_run; then - read -p "Enter to kill evething" xx + read -r -p "Enter to kill evething" xx sleep 3 at_app_exit exit 0