]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Escape commas for qemuBuildChrChardevStr
authorAnya Harter <aharter@redhat.com>
Mon, 18 Jun 2018 17:57:23 +0000 (13:57 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Mon, 18 Jun 2018 23:38:54 +0000 (19:38 -0400)
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 <aharter@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
src/qemu/qemu_command.c
tests/qemuxml2argvdata/name-escape.args
tests/qemuxml2argvdata/name-escape.xml
tests/qemuxml2argvtest.c

index bb956a77f444ba7691eb858e2a2c9f0135d6b1f6..b7640089495096ca97049fc0fa814c0358050683 100644 (file)
@@ -4975,9 +4975,10 @@ qemuBuildChrChardevStr(virLogManagerPtr logManager,
         break;
 
     case VIR_DOMAIN_CHR_TYPE_DEV:
-        virBufferAsprintf(&buf, "%s,id=%s,path=%s",
+        virBufferAsprintf(&buf, "%s,id=%s,path=",
                           STRPREFIX(alias, "parallel") ? "parport" : "tty",
-                          charAlias, dev->data.file.path);
+                          charAlias);
+        virQEMUBuildBufferEscapeComma(&buf, dev->data.file.path);
         break;
 
     case VIR_DOMAIN_CHR_TYPE_FILE:
@@ -4997,8 +4998,8 @@ qemuBuildChrChardevStr(virLogManagerPtr logManager,
         break;
 
     case VIR_DOMAIN_CHR_TYPE_PIPE:
-        virBufferAsprintf(&buf, "pipe,id=%s,path=%s", charAlias,
-                          dev->data.file.path);
+        virBufferAsprintf(&buf, "pipe,id=%s,path=", charAlias);
+        virQEMUBuildBufferEscapeComma(&buf, dev->data.file.path);
         break;
 
     case VIR_DOMAIN_CHR_TYPE_STDIO:
index 5ff8c03db812668e55f988075d1589cfdede441b..4b03068f950dd64dec7c297c21d35dda926a66b2 100644 (file)
@@ -23,6 +23,10 @@ bar=2/monitor.sock,server,nowait \
 -no-acpi \
 -boot c \
 -usb \
+-chardev tty,id=charserial0,path=/dev/ttyS2,,foo \
+-device isa-serial,chardev=charserial0,id=serial0 \
+-chardev pipe,id=charchannel0,path=/tmp/guestfwd,,foo \
+-netdev user,guestfwd=tcp:10.0.2.1:4600-chardev:charchannel0,id=user-channel0 \
 -vnc unix:/tmp/lib/domain--1-foo=1,,bar=2/vnc.sock \
 -spice unix,addr=/tmp/lib/domain--1-foo=1,,bar=2/spice.sock \
 -vga cirrus \
index 6b93d7179805b171ea26cf361263c06ae7c65031..3f5e1c9829aec63902000f50c0e4acfe24e1b9b3 100644 (file)
     <graphics type='spice'>
       <listen type='socket'/>
     </graphics>
+    <serial type='dev'>
+      <source path='/dev/ttyS2,foo'/>
+    </serial>
+    <channel type='pipe'>
+      <source path='/tmp/guestfwd,foo'/>
+      <target type='guestfwd' address='10.0.2.1' port='4600'/>
+    </channel>
   </devices>
 </domain>
index 194a8d2bab0d300748b14168fa40323da39d718d..f15454101275d99874aa6f509d5e42ecef5b6580 100644 (file)
@@ -2762,7 +2762,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);
 
     DO_TEST("master-key", QEMU_CAPS_OBJECT_SECRET);