public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] gdb: silence shellcheck warning SC2162 (use read -r) in gdbarch.sh
@ 2020-04-30  0:37 Simon Marchi
  0 siblings, 0 replies; only message in thread
From: Simon Marchi @ 2020-04-30  0:37 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ffc2844e9672ce4b2d9d2a4f6f676a46f64f4d09

commit ffc2844e9672ce4b2d9d2a4f6f676a46f64f4d09
Author: Simon Marchi <simon.marchi@efficios.com>
Date:   Wed Apr 29 20:35:35 2020 -0400

    gdb: silence shellcheck warning SC2162 (use read -r) in gdbarch.sh
    
    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.

Diff:
---
 gdb/ChangeLog  | 5 +++++
 gdb/gdbarch.sh | 1 +
 2 files changed, 6 insertions(+)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index eb6841640b9..830bc30979c 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index 24f8cdfe90b..13775078c25 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -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.
+    # shellcheck disable=SC2162
     while IFS='' read line
     do
 	if test "${line}" = ""


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-04-30  0:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-30  0:37 [binutils-gdb] gdb: silence shellcheck warning SC2162 (use read -r) in gdbarch.sh Simon Marchi

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 read-only IMAP folder(s) and NNTP newsgroup(s).