From nobody Mon Feb 9 23:01:04 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 (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 152937558834496.61794662703642; Mon, 18 Jun 2018 19:33:08 -0700 (PDT) Received: from localhost ([::1]:38657 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fV6S2-0004Fg-Sd for importer@patchew.org; Mon, 18 Jun 2018 22:32:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46883) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fV5jP-0002yd-8x for qemu-devel@nongnu.org; Mon, 18 Jun 2018 21:46:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fV5jN-0000lG-Tp for qemu-devel@nongnu.org; Mon, 18 Jun 2018 21:46:51 -0400 Received: from mail-ot0-x236.google.com ([2607:f8b0:4003:c0f::236]:41140) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fV5jN-0000ks-Oc; Mon, 18 Jun 2018 21:46:49 -0400 Received: by mail-ot0-x236.google.com with SMTP id d19-v6so20759420oti.8; Mon, 18 Jun 2018 18:46:49 -0700 (PDT) Received: from localhost (76-251-165-188.lightspeed.austtx.sbcglobal.net. [76.251.165.188]) by smtp.gmail.com with ESMTPSA id v8-v6sm16549341oti.35.2018.06.18.18.46.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Jun 2018 18:46:47 -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=ftdDvZT2hIih6q8dZVCgSF9+SG+DfEhlilK05fl6Sbk=; b=UqBAeS3tYt53m41d1FcD3ch39DAyyFvHo3r7V04xNRoR1nXyYCuw0sYtGPwUUDWh+w QKNiZ0in8O0bG3iaE0hcNtXeULwiljMBzV0pfhoYMRsyosdAaGOFKiBH52tJES+nxbk7 E0Pt0e5Gnb3uqPSVmgpAYqoPUnUjv9AE+WUxJ8yiA0I/YvKpG9mrXNhTtK0bpsSAHfy8 I7sKkWRrnIsliHB9vx58urIR8Mlvk29JbXouGMSrA0JLN8XQMGcogKxHu5oOxtvidcF4 mXsbGjjLKhvBckbukd8TjpK4axINte356E413H3d31aBbtV9tT5OFZxrdZJUXhhPT2De 6qMQ== 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=ftdDvZT2hIih6q8dZVCgSF9+SG+DfEhlilK05fl6Sbk=; b=l2k0UDwO/+gZM45ZlheT8f5pizkYBiJwJBsJiPMHRhxuQa7qFamc5RNeDZ67YkbVTr a7R+TERHpgk6SD7El0Iskm38pKJx2jcjnHRsfMyG995EUcqhkY9MQjd2HDUtehLSLAJ6 ZYlc/JfNmHAfYDFt0OxmSNd5/gEX7dZTRfSmtQloxKDfq6AqkDW0BHfxR+R4r073GB2e P1djU24bPv/DaIn/BVCf8uRiaj/qWy1kkAainDJFSglz3TlhYzRmdR44E+9jBTc4ZkGP LnpS3jzrIUPMDdcuq4ZFDb5iaziS7PwOk9iF6oVmmJ+a2fEpOGnAK9Hxqtiu7D8RYyYv LpRw== X-Gm-Message-State: APt69E0QqGyFlorXpue8b2Ln64kAiyTSorIFqKiDN1H3jPerErvuESMQ LThZpkuQgiAIK/Xv67CT2Le2rN5hLOg= X-Google-Smtp-Source: ADUXVKKbYxu31ps2oIax3ltTc5BIFVGMqa/v7BAbgCm2cGtQGcyH7F03I5suleLVewkirOFtZgWp+A== X-Received: by 2002:a9d:cd:: with SMTP id 13-v6mr9584011otk.155.1529372808557; Mon, 18 Jun 2018 18:46:48 -0700 (PDT) From: Michael Roth To: qemu-devel@nongnu.org Date: Mon, 18 Jun 2018 20:42:38 -0500 Message-Id: <20180619014319.28272-73-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180619014319.28272-1-mdroth@linux.vnet.ibm.com> References: <20180619014319.28272-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:c0f::236 Subject: [Qemu-devel] [PATCH 072/113] 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 c70bde3eb1..e6b608a564 100644 --- a/qemu-io.c +++ b/qemu-io.c @@ -71,12 +71,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.11.0