Re: [libvirt] [PATCH 1/4] qemu: Escape commas for qemuBuildChrChardevStr

2018-06-19 Thread John Ferlan



On 06/19/2018 10:19 AM, Anya Harter wrote:
> 
> 
> On 06/18/2018 07:37 PM, John Ferlan wrote:
>>
>>
>> On 06/18/2018 01:57 PM, Anya Harter wrote:
>>> 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 
>>> ---
>>>  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(-)
>>>
>>
>> Having tests is awesome! Thanks!
>>
>> Not sure why the bite size tasks omitted VIR_DOMAIN_CHR_TYPE_FILE too.
>> If you want to investigate the FILE case that'd be good - just to make
>> sure we aren't missing any!  I'll still push this as is since it's fine,
>> but if the FILE needs something it can be added afterwards.
> 
> VIR_DOMAIN_CHR_TYPE_FILE calls the function qemuBuildChrChardevFileStr
> and passes the dev->data.file.path into the parameter named fileval
> which I escape in the second patch.
> 
> Please let me know if I am missing something here.
> 

Nope I didn't dig far enough...

John

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH 1/4] qemu: Escape commas for qemuBuildChrChardevStr

2018-06-19 Thread Anya Harter



On 06/18/2018 07:37 PM, John Ferlan wrote:
> 
> 
> On 06/18/2018 01:57 PM, Anya Harter wrote:
>> 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 
>> ---
>>  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(-)
>>
> 
> Having tests is awesome! Thanks!
> 
> Not sure why the bite size tasks omitted VIR_DOMAIN_CHR_TYPE_FILE too.
> If you want to investigate the FILE case that'd be good - just to make
> sure we aren't missing any!  I'll still push this as is since it's fine,
> but if the FILE needs something it can be added afterwards.

VIR_DOMAIN_CHR_TYPE_FILE calls the function qemuBuildChrChardevFileStr
and passes the dev->data.file.path into the parameter named fileval
which I escape in the second patch.

Please let me know if I am missing something here.

Thanks,

Anya

> 
> Reviewed-by: John Ferlan 
> 
> John
> 

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH 1/4] qemu: Escape commas for qemuBuildChrChardevStr

2018-06-18 Thread John Ferlan



On 06/18/2018 01:57 PM, Anya Harter wrote:
> 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 
> ---
>  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(-)
> 

Having tests is awesome! Thanks!

Not sure why the bite size tasks omitted VIR_DOMAIN_CHR_TYPE_FILE too.
If you want to investigate the FILE case that'd be good - just to make
sure we aren't missing any!  I'll still push this as is since it's fine,
but if the FILE needs something it can be added afterwards.

Reviewed-by: John Ferlan 

John

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 1/4] qemu: Escape commas for qemuBuildChrChardevStr

2018-06-18 Thread Anya Harter
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 
---
 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;
 
 case VIR_DOMAIN_CHR_TYPE_DEV:
-virBufferAsprintf(, "%s,id=%s,path=%s",
+virBufferAsprintf(, "%s,id=%s,path=",
   STRPREFIX(alias, "parallel") ? "parport" : "tty",
-  charAlias, dev->data.file.path);
+  charAlias);
+virQEMUBuildBufferEscapeComma(, 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(, "pipe,id=%s,path=%s", charAlias,
-  dev->data.file.path);
+virBufferAsprintf(, "pipe,id=%s,path=", charAlias);
+virQEMUBuildBufferEscapeComma(, dev->data.file.path);
 break;
 
 case VIR_DOMAIN_CHR_TYPE_STDIO:
diff --git a/tests/qemuxml2argvdata/name-escape.args 
b/tests/qemuxml2argvdata/name-escape.args
index 5ff8c03db8..4b03068f95 100644
--- a/tests/qemuxml2argvdata/name-escape.args
+++ b/tests/qemuxml2argvdata/name-escape.args
@@ -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 \
diff --git a/tests/qemuxml2argvdata/name-escape.xml 
b/tests/qemuxml2argvdata/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);
 
 DO_TEST("master-key", QEMU_CAPS_OBJECT_SECRET);
-- 
2.17.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list