From: Simon Marchi <simon.marchi@efficios.com>
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@efficios.com>
Subject: [PATCH 2/7] gdb: fix shellcheck warnings SC2086 (missing double quotes) in gdbarch.sh
Date: Tue, 28 Apr 2020 17:46:50 -0400 [thread overview]
Message-ID: <20200428214655.3255454-3-simon.marchi@efficios.com> (raw)
In-Reply-To: <20200428214655.3255454-1-simon.marchi@efficios.com>
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.
---
gdb/gdbarch.sh | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index 2780a819f915..a934a7aa6bc1 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} <<EOF
+ eval read "${read}" <<EOF
${line}
EOF
IFS="${OFS}"
@@ -86,9 +86,9 @@ EOF
# that ended up with just that space character.
for r in ${read}
do
- if eval test \"\${${r}}\" = \"\ \"
+ if eval test "\"\${${r}}\" = ' '"
then
- eval ${r}=""
+ eval "${r}="
fi
done
@@ -1227,7 +1227,7 @@ ${class} ${returntype} ${function} ($formal)
EOF
for r in ${read}
do
- eval echo \"\ \ \ \ ${r}=\${${r}}\"
+ eval echo "\" ${r}=\${${r}}\""
done
if class_is_predicate_p && fallback_default_p
then
@@ -2162,7 +2162,7 @@ do
printf "\n"
printf "void\n"
printf "set_gdbarch_%s (struct gdbarch *gdbarch,\n" "$function"
- printf " `echo ${function} | sed -e 's/./ /g'` gdbarch_%s_ftype %s)\n" "$function" "$function"
+ printf " `echo "$function" | sed -e 's/./ /g'` gdbarch_%s_ftype %s)\n" "$function" "$function"
printf "{\n"
printf " gdbarch->%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"
--
2.26.2
next prev parent reply other threads:[~2020-04-28 21:47 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-28 21:46 [PATCH 0/7] Make gdbarch.sh shellcheck-clean Simon Marchi
2020-04-28 21:46 ` [PATCH 1/7] gdb: fix shellcheck warnings SC2059 (variables in printf format string) in gdbarch.sh Simon Marchi
2020-04-28 21:46 ` Simon Marchi [this message]
2020-04-28 21:46 ` [PATCH 3/7] gdb: fix shellcheck warnings SC2006 (use $() instead of ``) " Simon Marchi
2020-04-28 21:46 ` [PATCH 4/7] gdb: fix shellcheck warnings SC2166 (&& and !! instead of -a and -o) " Simon Marchi
2020-04-28 21:46 ` [PATCH 5/7] gdb: fix shellcheck warnings SC2034 (unused variable) " Simon Marchi
2020-04-28 21:46 ` [PATCH 6/7] gdb: fix shellcheck warnings SC2154 (referenced but not assigned) " Simon Marchi
2020-04-28 21:46 ` [PATCH 7/7] gdb: silence shellcheck warning SC2162 (use read -r) " Simon Marchi
2020-04-29 21:08 ` [PATCH 0/7] Make gdbarch.sh shellcheck-clean Tom Tromey
2020-04-30 0:34 ` Simon Marchi
2020-04-30 14:25 ` Tom Tromey
2020-04-30 15:48 ` Simon Marchi
2020-05-07 1:59 ` Tom Tromey
2020-05-10 18:57 ` Pedro Alves
2020-05-10 21:36 ` Simon Marchi
2020-05-11 16:55 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200428214655.3255454-3-simon.marchi@efficios.com \
--to=simon.marchi@efficios.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox