[binutils-gdb] gdb/testsuite: make gdb.tui/gdb.sh work with dash
Simon Marchi
simark@sourceware.org
Thu Oct 9 01:54:20 GMT 2025
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=7b67c40b51b36aea807261018ffb7b24065d5619
commit 7b67c40b51b36aea807261018ffb7b24065d5619
Author: Simon Marchi <simon.marchi@polymtl.ca>
Date: Wed Oct 8 21:49:50 2025 -0400
gdb/testsuite: make gdb.tui/gdb.sh work with dash
gdb.tui/gdb.sh (used by test gdb.tui/tuiterm-2.exp) doesn't run well
when /bin/sh is dash:
$ bash testsuite/gdb.tui/gdb.sh
foo^C
$ dash testsuite/gdb.tui/gdb.sh
footestsuite/gdb.tui/gdb.sh: 20: read: arg count
shellcheck actually points it out:
In testsuite/gdb.tui/gdb.sh line 20:
read
^--^ SC3061 (warning): In POSIX sh, read without a variable is undefined.
^--^ SC2162 (info): read without -r will mangle backslashes.
Fix the issue by passing the `_` dummy variable. Using that particular
variable will not cause shellcheck to whine about it being unused. Also
add `-r` to make it happy.
Change-Id: Ida3eddbfa3473487743fc96615baf735b4773738
Diff:
---
gdb/testsuite/gdb.tui/gdb.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/testsuite/gdb.tui/gdb.sh b/gdb/testsuite/gdb.tui/gdb.sh
index 0079a3fb441..32a4e8a98a7 100755
--- a/gdb/testsuite/gdb.tui/gdb.sh
+++ b/gdb/testsuite/gdb.tui/gdb.sh
@@ -17,4 +17,4 @@
printf "foo\033(%%5"
-read
+read -r _
More information about the Gdb-cvs
mailing list