[lvm-devel] master - tests: utils.sh double quote

Zdenek Kabelac zkabelac at sourceware.org
Thu Jun 29 20:29:10 UTC 2017


Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=c396053955c6481cfc753f498af9a61202ce2d91
Commit:        c396053955c6481cfc753f498af9a61202ce2d91
Parent:        b442861f50eee6e571143fc8b62131be13e7aa91
Author:        Zdenek Kabelac <zkabelac at redhat.com>
AuthorDate:    Thu Jun 29 10:12:21 2017 +0200
Committer:     Zdenek Kabelac <zkabelac at redhat.com>
CommitterDate: Thu Jun 29 22:23:17 2017 +0200

tests: utils.sh double quote

---
 test/lib/utils.sh |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/test/lib/utils.sh b/test/lib/utils.sh
index 60979cc..c15eef3 100644
--- a/test/lib/utils.sh
+++ b/test/lib/utils.sh
@@ -35,16 +35,16 @@ rand_bytes() {
 	cmds='date; date +%N; free; who -a; w; ps auxww; ps ef; netstat -n'
 	data=$( (eval "$cmds") 2>&1 | gzip )
 
-	n_plus_50=$(expr $n + 50)
+	n_plus_50=$(( n + 50 ))
 
 	# Ensure that $data has length at least 50+$n
 	while :; do
 		len=$(echo "$data" | wc -c)
-		test $n_plus_50 -le $len && break;
+		test "$n_plus_50" -le "$len" && break;
 		data=$( (echo "$data"; eval "$cmds") 2>&1 | gzip )
 	done
 
-	echo "$data" | dd bs=1 skip=50 count=$n 2>/dev/null \
+	echo "$data" | dd bs=1 skip=50 count="$n" 2>/dev/null \
 		| tr -c "$chars" "01234567$chars$chars$chars"
 }
 
@@ -137,7 +137,7 @@ STACKTRACE() {
 		for core in $(ls core* 2>/dev/null); do
 			bin=$(gdb -batch -c "$core" 2>&1 | grep "generated by" | \
 			sed -e "s,.*generated by \`\([^ ']*\).*,\1,")
-			gdb -batch -c "$core" -x gdb_commands.txt $(which "$bin")
+			gdb -batch -c "$core" -x gdb_commands.txt "$(which "$bin")"
 		done
 	fi
 
@@ -159,7 +159,7 @@ STACKTRACE() {
 			sed -e "s,^,## STRACE: ," strace.log
 		fi
 		dmsetup info -c | grep1_ "$PREFIX" > out
-		if test $(wc -l < out) -gt 1 ; then
+		if test "$(wc -l < out)" -gt 1 ; then
 			echo "<======== Info ========>"
 			sed -e "s,^,## DMINFO:   ," out
 			echo "<======== Active table ========>"
@@ -258,7 +258,7 @@ if test -z "${installed_testsuite+varset}"; then
     case "$PATH" in
     *"$abs_top_builddir/test/lib"*) ;;
     *)
-	PATH="$abs_top_builddir/test/lib":"$abs_top_builddir/test/api":$PATH
+	PATH="$abs_top_builddir/test/lib:$abs_top_builddir/test/api:$PATH"
 	LD_LIBRARY_PATH=$(find -L "$abs_top_builddir/libdm/" "$abs_top_builddir/tools/"\
 		"$abs_top_builddir/daemons/" "$abs_top_builddir/liblvm/"\
 		-name "*.so" -printf "%h:")"$LD_LIBRARY_PATH"




More information about the lvm-devel mailing list