From nobody Sun Feb 8 18:29:55 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 153237783618529.7353744499992; Mon, 23 Jul 2018 13:30:36 -0700 (PDT) Received: from localhost ([::1]:36389 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fhhTX-0003f3-2o for importer@patchew.org; Mon, 23 Jul 2018 16:30:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40656) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fhhID-0001O4-EE for qemu-devel@nongnu.org; Mon, 23 Jul 2018 16:18:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fhhIC-0002Oz-G5 for qemu-devel@nongnu.org; Mon, 23 Jul 2018 16:18:53 -0400 Received: from mail-oi0-x231.google.com ([2607:f8b0:4003:c06::231]:35533) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fhhIC-0002Ny-A2; Mon, 23 Jul 2018 16:18:52 -0400 Received: by mail-oi0-x231.google.com with SMTP id i12-v6so3493817oik.2; Mon, 23 Jul 2018 13:18:52 -0700 (PDT) Received: from localhost (76-251-165-188.lightspeed.austtx.sbcglobal.net. [76.251.165.188]) by smtp.gmail.com with ESMTPSA id n84-v6sm7548602oif.23.2018.07.23.13.18.49 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Jul 2018 13:18:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=I1qUby2ZYBVo1DN3ctJZ7vRPrhcaNSDkreQyMnQqsAQ=; b=ulAL0PhdyGM18wBjZVoIyDDZeFoMBjnP0MY/kaefqE4vhOrvAbPN2rA8NiVKvfanVT WsQwUP3QG4avZs6FYo5QLMQN9nmRrlD4sYPKnP9MrVehfI3u9oVXbACZzKp8xkfN2aq+ VNL8AMxqB+TF3vPyzVnlboCAL7sEARu2mG50vMOxI/i2VQw1QgdVkr77f+DcM8sGRi/4 cTdqkF0+Pt5fberBeE3220J7kIh7fIXd7zF7+lM3JIUXwpbHYnAhAkVw7if+SxAwc+Lf xXhjmK7rvJh9Pkj26d4WUYHsU9Af+KcfwhqG8vetRN1/ugEsY6GR3XeyligBTyDmxaTR Qt/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=I1qUby2ZYBVo1DN3ctJZ7vRPrhcaNSDkreQyMnQqsAQ=; b=spELpYXMVuRwFjPw7acoi7FnZbVN1PAqXQk/7b43gOyi9D6XHjWGQkrxdVLQsh5BsS CC8VyY5xkdbyFFQ7dNuo6hW5cAQItukojanWBRGsjOsgoBEVKJoI4AqCzDbDuRpmuumj mH+5CjGlZ15yX7jfKccWdBfKdLbdMxOMolJ0Qwo6jf4eNJynyWkY9X8T+K+mFyoVhpYv WwK6vMPdVW08Nf/TuilyCHvDgvZ77Yi2Qd6NFg5WMAJbvutLbl7YAm54LcNuOLPP0/Yd 87uEx+5rZqE/j7kaX8iHhhMM4vLeASXRs1HT2sZ1tAoD5teklyAUv33DKlVq6PkOx+wJ Qz2w== X-Gm-Message-State: AOUpUlEhnHJ7RCXXKkb3rUMqfYrtHmPrBBdxqahuEBoYpJ/KOBuvdFi5 XhO80qvR5/ew50B1K9XKqehwiRtjXII= X-Google-Smtp-Source: AAOMgpcCypqCTd56x9Zli+bM5D/jVWzjzp1N1hSwwWYRBTBdHZO7kkmZwNrcmZ70fniHUWCgV610Jg== X-Received: by 2002:aca:6b51:: with SMTP id g78-v6mr321745oic.290.1532377131221; Mon, 23 Jul 2018 13:18:51 -0700 (PDT) From: Michael Roth To: qemu-devel@nongnu.org Date: Mon, 23 Jul 2018 15:16:23 -0500 Message-Id: <20180723201748.25573-15-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180723201748.25573-1-mdroth@linux.vnet.ibm.com> References: <20180723201748.25573-1-mdroth@linux.vnet.ibm.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4003:c06::231 Subject: [Qemu-devel] [PATCH 14/99] qemu-io: Use purely string blockdev options X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-stable@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Max Reitz Currently, qemu-io only uses string-valued blockdev options (as all are converted directly from QemuOpts) -- with one exception: -U adds the force-share option as a boolean. This in itself is already a bit questionable, but a real issue is that it also assumes the value already existing in the options QDict would be a boolean, which is wrong. That has the following effect: $ ./qemu-io -r -U --image-opts \ driver=3Dfile,filename=3D/dev/null,force-share=3Doff [1] 15200 segmentation fault (core dumped) ./qemu-io -r -U --image-opts driver=3Dfile,filename=3D/dev/null,force-share=3Doff Since @opts is converted from QemuOpts, the value must be a string, and we have to compare it as such. Consequently, it makes sense to also set it as a string instead of a boolean. Cc: qemu-stable@nongnu.org Signed-off-by: Max Reitz Message-id: 20180502202051.15493-2-mreitz@redhat.com Reviewed-by: Eric Blake Signed-off-by: Max Reitz (cherry picked from commit 2a01c01f9ecb43af4c0a85fe6adc429ffc9c31b5) Signed-off-by: Michael Roth --- qemu-io.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qemu-io.c b/qemu-io.c index e692c555e0..0755a30447 100644 --- a/qemu-io.c +++ b/qemu-io.c @@ -95,12 +95,12 @@ static int openfile(char *name, int flags, bool writeth= rough, bool force_share, opts =3D qdict_new(); } if (qdict_haskey(opts, BDRV_OPT_FORCE_SHARE) - && !qdict_get_bool(opts, BDRV_OPT_FORCE_SHARE)) { + && strcmp(qdict_get_str(opts, BDRV_OPT_FORCE_SHARE), "on")) { error_report("-U conflicts with image options"); QDECREF(opts); return 1; } - qdict_put_bool(opts, BDRV_OPT_FORCE_SHARE, true); + qdict_put_str(opts, BDRV_OPT_FORCE_SHARE, "on"); } qemuio_blk =3D blk_new_open(name, NULL, opts, flags, &local_err); if (!qemuio_blk) { --=20 2.17.1