[libgpiod][PATCH v2 4/8] tools: tests: use read -r to avoid mangling backslashes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Fix shellcheck SC2162[1] - read without -r will mangle backslashes.

[1] https://www.shellcheck.net/wiki/SC2162

Signed-off-by: Kent Gibson <warthog618@xxxxxxxxx>
---
 tools/gpio-tools-test.bash | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/gpio-tools-test.bash b/tools/gpio-tools-test.bash
index b065296..efe558b 100755
--- a/tools/gpio-tools-test.bash
+++ b/tools/gpio-tools-test.bash
@@ -188,7 +188,7 @@ dut_run() {
 	shift
 	coproc timeout 10s "$SOURCE_DIR/$cmd" "$@" 2>&1
 	DUT_PID=$COPROC_PID
-	read -t1 -n1 -u ${COPROC[0]} DUT_FIRST_CHAR
+	read -r -t1 -n1 -u "${COPROC[0]}" DUT_FIRST_CHAR
 }
 
 dut_run_redirect() {
@@ -211,7 +211,7 @@ dut_read_redirect() {
 dut_read() {
 	local LINE
 	lines=()
-	while read -t 0.2 -u ${COPROC[0]} LINE
+	while read -r -t 0.2 -u "${COPROC[0]}" LINE
 	do
 		if [ -n "$DUT_FIRST_CHAR" ]
 		then
@@ -234,7 +234,7 @@ dut_flush() {
 	unset DUT_FIRST_CHAR
 	while read -t 0 -u "${COPROC[0]}" _JUNK
 	do
-		read -t 0.1 -u "${COPROC[0]}" _JUNK || true
+		read -r -t 0.1 -u "${COPROC[0]}" _JUNK || true
 	done
 }
 
@@ -242,7 +242,7 @@ dut_flush() {
 dut_regex_match() {
 	PATTERN=$1
 
-	read -t 0.2 -u ${COPROC[0]} LINE || (echo Timeout && false)
+	read -r -t 0.2 -u "${COPROC[0]}" LINE || (echo Timeout && false)
 	if [ -n "$DUT_FIRST_CHAR" ]
 	then
 		LINE=${DUT_FIRST_CHAR}${LINE}
-- 
2.39.2





[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux