]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb/testsuite: make gdb.tui/gdb.sh work with dash
authorSimon Marchi <simon.marchi@polymtl.ca>
Thu, 9 Oct 2025 01:49:50 +0000 (21:49 -0400)
committerSimon Marchi <simon.marchi@polymtl.ca>
Thu, 9 Oct 2025 01:52:32 +0000 (21:52 -0400)
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

gdb/testsuite/gdb.tui/gdb.sh

index 0079a3fb4416cbb1fce9ef9da579b9f18fb2344e..32a4e8a98a75893fa2abaca0ea1bca86f4007a68 100755 (executable)
@@ -17,4 +17,4 @@
 
 printf "foo\033(%%5"
 
-read
+read -r _