gdb: silence shellcheck warning SC2162 (use read -r) in gdbarch.sh
authorSimon Marchi <simon.marchi@efficios.com>
Thu, 30 Apr 2020 00:35:35 +0000 (20:35 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Thu, 30 Apr 2020 00:35:36 +0000 (20:35 -0400)
shellcheck reports:

    In gdbarch.sh line 53:
        while IFS='' read line
                     ^--^ SC2162: read without -r will mangle backslashes.

See the rationale at [1].  In our case, we actually want the backslashes
to be interpreted and removed.  Silence the warning using a directive.

[1] https://github.com/koalaman/shellcheck/wiki/SC2162

gdb/ChangeLog:

* gdbarch.sh (do_read): Add shellcheck disable directive for
warning SC2162.

gdb/ChangeLog
gdb/gdbarch.sh

index eb6841640b9a7dbdb9da36f24c8fb5ca1e68b6d1..830bc30979cba33643f816cab85f2ea48caacadc 100644 (file)
@@ -1,3 +1,8 @@
+2020-04-29  Simon Marchi  <simon.marchi@efficios.com>
+
+       * gdbarch.sh (do_read): Add shellcheck disable directive for
+       warning SC2162.
+
 2020-04-29  Simon Marchi  <simon.marchi@efficios.com>
 
        * gdbarch.sh: Use ${foo:-} where shellcheck would report a
 2020-04-29  Simon Marchi  <simon.marchi@efficios.com>
 
        * gdbarch.sh: Use ${foo:-} where shellcheck would report a
index 24f8cdfe90b043f0af4ff1add850856e62dce22f..13775078c25a5479a40f9ccbd6e65907b000837b 100755 (executable)
@@ -50,6 +50,7 @@ do_read ()
     # On some SH's, 'read' trims leading and trailing whitespace by
     # default (e.g., bash), while on others (e.g., dash), it doesn't.
     # Set IFS to empty to disable the trimming everywhere.
     # On some SH's, 'read' trims leading and trailing whitespace by
     # default (e.g., bash), while on others (e.g., dash), it doesn't.
     # Set IFS to empty to disable the trimming everywhere.
+    # shellcheck disable=SC2162
     while IFS='' read line
     do
        if test "${line}" = ""
     while IFS='' read line
     do
        if test "${line}" = ""
This page took 0.031801 seconds and 4 git commands to generate.