From nobody Thu Jul 3 19:53:04 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1529344666146810.9786048602613; Mon, 18 Jun 2018 10:57:46 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B3FCE81DFA; Mon, 18 Jun 2018 17:57:44 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1C2CC5D9D1; Mon, 18 Jun 2018 17:57:44 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 629CA1800538; Mon, 18 Jun 2018 17:57:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w5IHvce5027834 for ; Mon, 18 Jun 2018 13:57:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id DA242111DCEF; Mon, 18 Jun 2018 17:57:38 +0000 (UTC) Received: from dhcp-17-130.bos.redhat.com (dhcp-17-130.bos.redhat.com [10.18.17.130]) by smtp.corp.redhat.com (Postfix) with ESMTP id C08E1111DCE8; Mon, 18 Jun 2018 17:57:38 +0000 (UTC) From: Anya Harter To: libvir-list@redhat.com Date: Mon, 18 Jun 2018 13:57:23 -0400 Message-Id: <1d5368f19f03275e6add82abb0a03a6eab0c6972.1529344085.git.aharter@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Cc: Anya Harter Subject: [libvirt] [PATCH 1/4] qemu: Escape commas for qemuBuildChrChardevStr X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 18 Jun 2018 17:57:45 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Add comma escaping for dev->data.file.path in cases VIR_DOMAIN_CHR_TYPE_DEV and VIR_DOMAIN_CHR_TYPE_PIPE. Signed-off-by: Anya Harter Reviewed-by: John Ferlan --- src/qemu/qemu_command.c | 9 +++++---- tests/qemuxml2argvdata/name-escape.args | 4 ++++ tests/qemuxml2argvdata/name-escape.xml | 7 +++++++ tests/qemuxml2argvtest.c | 3 ++- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index bb956a77f4..b764008949 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -4975,9 +4975,10 @@ qemuBuildChrChardevStr(virLogManagerPtr logManager, break; =20 case VIR_DOMAIN_CHR_TYPE_DEV: - virBufferAsprintf(&buf, "%s,id=3D%s,path=3D%s", + virBufferAsprintf(&buf, "%s,id=3D%s,path=3D", STRPREFIX(alias, "parallel") ? "parport" : "tty", - charAlias, dev->data.file.path); + charAlias); + virQEMUBuildBufferEscapeComma(&buf, dev->data.file.path); break; =20 case VIR_DOMAIN_CHR_TYPE_FILE: @@ -4997,8 +4998,8 @@ qemuBuildChrChardevStr(virLogManagerPtr logManager, break; =20 case VIR_DOMAIN_CHR_TYPE_PIPE: - virBufferAsprintf(&buf, "pipe,id=3D%s,path=3D%s", charAlias, - dev->data.file.path); + virBufferAsprintf(&buf, "pipe,id=3D%s,path=3D", charAlias); + virQEMUBuildBufferEscapeComma(&buf, dev->data.file.path); break; =20 case VIR_DOMAIN_CHR_TYPE_STDIO: diff --git a/tests/qemuxml2argvdata/name-escape.args b/tests/qemuxml2argvda= ta/name-escape.args index 5ff8c03db8..4b03068f95 100644 --- a/tests/qemuxml2argvdata/name-escape.args +++ b/tests/qemuxml2argvdata/name-escape.args @@ -23,6 +23,10 @@ bar=3D2/monitor.sock,server,nowait \ -no-acpi \ -boot c \ -usb \ +-chardev tty,id=3Dcharserial0,path=3D/dev/ttyS2,,foo \ +-device isa-serial,chardev=3Dcharserial0,id=3Dserial0 \ +-chardev pipe,id=3Dcharchannel0,path=3D/tmp/guestfwd,,foo \ +-netdev user,guestfwd=3Dtcp:10.0.2.1:4600-chardev:charchannel0,id=3Duser-c= hannel0 \ -vnc unix:/tmp/lib/domain--1-foo=3D1,,bar=3D2/vnc.sock \ -spice unix,addr=3D/tmp/lib/domain--1-foo=3D1,,bar=3D2/spice.sock \ -vga cirrus \ diff --git a/tests/qemuxml2argvdata/name-escape.xml b/tests/qemuxml2argvdat= a/name-escape.xml index 6b93d71798..3f5e1c9829 100644 --- a/tests/qemuxml2argvdata/name-escape.xml +++ b/tests/qemuxml2argvdata/name-escape.xml @@ -20,5 +20,12 @@ + + + + + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index f44cac9fef..c194ff59c9 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2760,7 +2760,8 @@ mymain(void) QEMU_CAPS_NAME_GUEST, QEMU_CAPS_DEVICE_CIRRUS_VGA, QEMU_CAPS_SPICE, - QEMU_CAPS_SPICE_UNIX); + QEMU_CAPS_SPICE_UNIX, + QEMU_CAPS_DEVICE_ISA_SERIAL); DO_TEST("debug-threads", QEMU_CAPS_NAME_DEBUG_THREADS); =20 DO_TEST("master-key", QEMU_CAPS_OBJECT_SECRET); --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list