[Drbd-dev] [PATCH 2/6] drbd.ocf: Avoid splitting array elements

Bart Van Assche bart.vanassche at sandisk.com
Tue Jun 14 13:55:39 CEST 2016


This patch avoids that shellcheck reports the following:

  error: Double quote array expansions to avoid re-splitting elements. [SC2068]

Signed-off-by: Bart Van Assche <bart.vanassche at sandisk.com>
---
 scripts/drbd.ocf | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/scripts/drbd.ocf b/scripts/drbd.ocf
index 2335062..44c4e44 100755
--- a/scripts/drbd.ocf
+++ b/scripts/drbd.ocf
@@ -375,11 +375,11 @@ drbd_set_status_variables() {
 	[[ ${#DRBD_DSTATE_REMOTE[@]} != 0 ]] || DRBD_DSTATE_REMOTE=(DUnknown)
 
 
-	: == DEBUG == DRBD_ROLE_LOCAL    == ${DRBD_ROLE_LOCAL[@]} ==
-	: == DEBUG == DRBD_ROLE_REMOTE   == ${DRBD_ROLE_REMOTE[@]} ==
-	: == DEBUG == DRBD_CSTATE        == ${DRBD_CSTATE[@]} ==
-	: == DEBUG == DRBD_DSTATE_LOCAL  == ${DRBD_DSTATE_LOCAL[@]} ==
-	: == DEBUG == DRBD_DSTATE_REMOTE == ${DRBD_DSTATE_REMOTE[@]} ==
+	: == DEBUG == DRBD_ROLE_LOCAL    == "${DRBD_ROLE_LOCAL[@]}" ==
+	: == DEBUG == DRBD_ROLE_REMOTE   == "${DRBD_ROLE_REMOTE[@]}" ==
+	: == DEBUG == DRBD_CSTATE        == "${DRBD_CSTATE[@]}" ==
+	: == DEBUG == DRBD_DSTATE_LOCAL  == "${DRBD_DSTATE_LOCAL[@]}" ==
+	: == DEBUG == DRBD_DSTATE_REMOTE == "${DRBD_DSTATE_REMOTE[@]}" ==
 }
 
 call_unfence()
@@ -621,7 +621,7 @@ drbd_status() {
 	# done with maintenance-mode enabled.
 	# If someone does manually kill/remove only some of the volumes,
 	# we tolerate that here.
-	for dev in ${DRBD_DEVICES[@]} ""; do
+	for dev in "${DRBD_DEVICES[@]}" ""; do
 		test -b $dev && break
 	done
 	[[ $dev ]] || return $rc
@@ -701,7 +701,7 @@ figure_out_drbd_peer_uname()
 
 my_udevsettle()
 {
-	for dev in ${DRBD_DEVICES[@]}; do
+	for dev in "${DRBD_DEVICES[@]}"; do
 		while ! test -b $dev; do
 			sleep 1;
 		done
-- 
2.8.4



More information about the drbd-dev mailing list