linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kent Gibson <warthog618@gmail.com>
To: linux-gpio@vger.kernel.org, brgl@bgdev.pl
Cc: Kent Gibson <warthog618@gmail.com>
Subject: [libgpiod][PATCH 4/8] tools: tests: use read -r to avoid mangling backslashes
Date: Fri, 31 May 2024 21:45:08 +0800	[thread overview]
Message-ID: <20240531134512.443850-5-warthog618@gmail.com> (raw)
In-Reply-To: <20240531134512.443850-1-warthog618@gmail.com>

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

Signed-off-by: Kent Gibson <warthog618@gmail.com>

[1] https://www.shellcheck.net/wiki/SC2162
---
 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


  parent reply	other threads:[~2024-05-31 13:46 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-31 13:45 [libgpiod][PATCH 0/8] tools: tests: fix shellcheck warnings Kent Gibson
2024-05-31 13:45 ` [libgpiod][PATCH 1/8] tools: tests: don't mix string and array Kent Gibson
2024-05-31 13:45 ` [libgpiod][PATCH 2/8] tools: tests: don't declare and assign separately Kent Gibson
2024-06-03  8:52   ` Bartosz Golaszewski
2024-06-03  8:58     ` Kent Gibson
2024-06-03 10:38       ` Bartosz Golaszewski
2024-06-03 10:39         ` Kent Gibson
2024-05-31 13:45 ` [libgpiod][PATCH 3/8] tools: tests: fix unused variables Kent Gibson
2024-05-31 13:45 ` Kent Gibson [this message]
2024-05-31 13:45 ` [libgpiod][PATCH 5/8] tools: tests: don't use variables in printf format string Kent Gibson
2024-05-31 13:45 ` [libgpiod][PATCH 6/8] tools: tests: check exit code directly Kent Gibson
2024-05-31 13:45 ` [libgpiod][PATCH 7/8] tools: tests: shellcheck don't follow sourced file Kent Gibson
2024-05-31 13:45 ` [libgpiod][PATCH 8/8] tools: tests: avoid splitting and globbing Kent Gibson
2024-06-03 10:40 ` [libgpiod][PATCH 0/8] tools: tests: fix shellcheck warnings Bartosz Golaszewski
2024-06-03 10:43   ` Kent Gibson
2024-06-03 10:59     ` Kent Gibson
2024-06-03 11:51       ` Bartosz Golaszewski
2024-06-03 14:59       ` Konstantin Ryabitsev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240531134512.443850-5-warthog618@gmail.com \
    --to=warthog618@gmail.com \
    --cc=brgl@bgdev.pl \
    --cc=linux-gpio@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).