qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Unai Martinez-Corral <unai.martinezcorral@ehu.eus>
To: qemu-devel@nongnu.org
Cc: riku.voipio@iki.fi, laurent@vivier.eu
Subject: [PATCH v10 02/10] qemu-binfmt-conf.sh: enforce safe tests
Date: Mon, 9 Mar 2020 19:19:24 +0000	[thread overview]
Message-ID: <20200309191924.GB65@669c1c222ef4> (raw)
In-Reply-To: <20200309191200.GA60@669c1c222ef4>

All the tests are prefixed with 'x', in order to avoid risky comparisons
(i.e. a user deliberately trying to provoke a syntax error).

Signed-off-by: Unai Martinez-Corral <unai.martinezcorral@ehu.eus>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
---
 scripts/qemu-binfmt-conf.sh | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh
index c728443ba2..98401f4e7c 100755
--- a/scripts/qemu-binfmt-conf.sh
+++ b/scripts/qemu-binfmt-conf.sh
@@ -259,10 +259,10 @@ qemu_check_systemd() {
 
 qemu_generate_register() {
     flags=""
-    if [ "$CREDENTIAL" = "yes" ]; then
+    if [ "x$CREDENTIAL" = "xyes" ]; then
         flags="OC"
     fi
-    if [ "$PERSISTENT" = "yes" ]; then
+    if [ "x$PERSISTENT" = "xyes" ]; then
         flags="${flags}F"
     fi
 
@@ -300,18 +300,18 @@ qemu_set_binfmts() {
         mask=$(eval echo \$${cpu}_mask)
         family=$(eval echo \$${cpu}_family)
 
-        if [ "$magic" = "" ] || [ "$mask" = "" ] || [ "$family" = "" ]; then
+        if [ "x$magic" = "x" ] || [ "x$mask" = "x" ] || [ "x$family" = "x" ]; then
             echo "INTERNAL ERROR: unknown cpu $cpu" 1>&2
             continue
         fi
 
         qemu="$QEMU_PATH/qemu-$cpu"
-        if [ "$cpu" = "i486" ]; then
+        if [ "x$cpu" = "xi486" ]; then
             qemu="$QEMU_PATH/qemu-i386"
         fi
 
         qemu="$qemu$QEMU_SUFFIX"
-        if [ "$host_family" != "$family" ]; then
+        if [ "x$host_family" != "x$family" ]; then
             $BINFMT_SET
         fi
     done
-- 
2.25.1




  parent reply	other threads:[~2020-03-09 19:20 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-09 19:12 [PATCH v10 0/10] qemu-binfmt-conf.sh Unai Martinez-Corral
2020-03-09 19:18 ` [PATCH v10 01/10] qemu-binfmt-conf.sh: enforce style consistency Unai Martinez-Corral
2020-03-09 19:30   ` Eric Blake
2020-03-09 19:36     ` Unai Martinez Corral
2020-03-10  8:39       ` Laurent Vivier
2020-03-09 19:19 ` Unai Martinez-Corral [this message]
2020-03-09 19:31   ` [PATCH v10 02/10] qemu-binfmt-conf.sh: enforce safe tests Eric Blake
2020-03-10  8:28   ` Laurent Vivier
2020-03-10 11:47     ` Eric Blake
2020-03-13  0:15       ` Unai Martinez Corral
2020-03-09 19:19 ` [PATCH v10 03/10] qemu-binfmt-conf.sh: make opts -p and -c boolean Unai Martinez-Corral
2020-03-09 19:20 ` [PATCH v10 04/10] qemu-binfmt-conf.sh: add QEMU_CREDENTIAL and QEMU_PERSISTENT Unai Martinez-Corral
2020-03-10  8:20   ` Laurent Vivier
2020-03-13  0:09     ` Unai Martinez Corral
2020-03-09 19:20 ` [PATCH v10 05/10] qemu-binfmt-conf.sh: use the same presentation format as for qemu-* Unai Martinez-Corral
2020-03-09 19:22 ` [PATCH v10 06/10] qemu-binfmt-conf.sh: remove 'qemu' prefix from cli options Unai Martinez-Corral
2020-03-09 19:22 ` [PATCH v10 07/10] qemu-binfmt-conf.sh: honour QEMU_PATH and/or QEMU_SUFFIX Unai Martinez-Corral
2020-03-09 19:23 ` [PATCH v10 08/10] qemu-binfmt-conf.sh: generalize <CPU> to positional [TARGETS] Unai Martinez-Corral
2020-03-09 19:23 ` [PATCH v10 09/10] qemu-binfmt-conf.sh: add option --clear Unai Martinez-Corral
2020-03-09 19:24 ` [PATCH v10 10/10] qemu-binfmt-conf.sh: add --test Unai Martinez-Corral
2020-03-09 19:58 ` [PATCH v10 0/10] qemu-binfmt-conf.sh no-reply
2020-03-09 20:05 ` no-reply

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=20200309191924.GB65@669c1c222ef4 \
    --to=unai.martinezcorral@ehu.eus \
    --cc=laurent@vivier.eu \
    --cc=qemu-devel@nongnu.org \
    --cc=riku.voipio@iki.fi \
    /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;
as well as URLs for NNTP newsgroup(s).