From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1879) id 814C73894E6B; Thu, 30 Apr 2020 00:36:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 814C73894E6B Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Simon Marchi To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb: fix shellcheck warnings SC2086 (missing double quotes) in gdbarch.sh X-Act-Checkin: binutils-gdb X-Git-Author: Simon Marchi X-Git-Refname: refs/heads/master X-Git-Oldrev: 8d113d130ef87c982896412f89154a5fa5afc9ac X-Git-Newrev: a6fc5ffc502238fcc5bce98868f4f353cc5d47d1 Message-Id: <20200430003658.814C73894E6B@sourceware.org> Date: Thu, 30 Apr 2020 00:36:58 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Apr 2020 00:36:58 -0000 https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=a6fc5ffc502238fcc5bce98868f4f353cc5d47d1 commit a6fc5ffc502238fcc5bce98868f4f353cc5d47d1 Author: Simon Marchi Date: Wed Apr 29 20:35:34 2020 -0400 gdb: fix shellcheck warnings SC2086 (missing double quotes) in gdbarch.sh Fix all instances of: In gdbarch.sh line 31: if test ! -r ${file} ^-----^ SC2086: Double quote to prevent globbing and word splitting. Did you mean: if test ! -r "${file}" Note that some instances of these are in text that is eval'ed. I'm pretty sure that things could go wrong during the eval too, but that's not something shellcheck can check. gdb/ChangeLog: * gdbarch.sh: Use double quotes around variables. Diff: --- gdb/ChangeLog | 4 ++++ gdb/gdbarch.sh | 16 ++++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index b6928233fb8..eefeac4c180 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2020-04-29 Simon Marchi + + * gdbarch.sh: Use double quotes around variables. + 2020-04-29 Simon Marchi * gdbarch.sh: Use %s with printf, instead of variables in the diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 2780a819f91..a934a7aa6bc 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -28,10 +28,10 @@ LC_ALL=C ; export LC_ALL compare_new () { file=$1 - if test ! -r ${file} + if test ! -r "${file}" then echo "${file} missing? cp new-${file} ${file}" 1>&2 - elif diff -u ${file} new-${file} + elif diff -u "${file}" "new-${file}" then echo "${file} unchanged" 1>&2 else @@ -70,7 +70,7 @@ ${line}" line="`echo "${line}" | sed -e 's/;;/; ;/g' -e 's/;;/; ;/g'`" OFS="${IFS}" ; IFS="[;]" - eval read ${read} <%s = %s;\n" "$function" "$function" printf "}\n" @@ -2192,7 +2192,7 @@ do printf "\n" printf "void\n" printf "set_gdbarch_%s (struct gdbarch *gdbarch,\n" "$function" - printf " `echo ${function} | sed -e 's/./ /g'` %s %s)\n" "$returntype" "$function" + printf " `echo "$function" | sed -e 's/./ /g'` %s %s)\n" "$returntype" "$function" printf "{\n" printf " gdbarch->%s = %s;\n" "$function" "$function" printf "}\n"