[PATCH 3/6] conf: Fix parsing python style triple quotes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



An incorrect check broke matching the closing set of quotes. Update
tests to cover this case for XM config files.

Signed-off-by: Cole Robinson <crobinso@xxxxxxxxxx>
---
 src/util/conf.c                          |    3 ++-
 tests/xmconfigdata/test-escape-paths.cfg |    2 +-
 tests/xmconfigdata/test-escape-paths.xml |    5 +++++
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/util/conf.c b/src/util/conf.c
index a31bbc4..d9a7603 100644
--- a/src/util/conf.c
+++ b/src/util/conf.c
@@ -400,8 +400,9 @@ virConfParseString(virConfParserCtxtPtr ctxt)
         ctxt->cur += 3;
         base = ctxt->cur;
 
+        /* Find the ending triple quotes */
         while ((ctxt->cur + 2 < ctxt->end) &&
-               (STRPREFIX(ctxt->cur, "\"\"\""))) {
+               !(STRPREFIX(ctxt->cur, "\"\"\""))) {
             if (CUR == '\n')
                 ctxt->line++;
             NEXT;
diff --git a/tests/xmconfigdata/test-escape-paths.cfg b/tests/xmconfigdata/test-escape-paths.cfg
index f9f2cb8..e3e6db9 100644
--- a/tests/xmconfigdata/test-escape-paths.cfg
+++ b/tests/xmconfigdata/test-escape-paths.cfg
@@ -19,7 +19,7 @@ vnc = 1
 vncunused = 1
 vnclisten = "127.0.0.1"
 vncpasswd = "123poi"
-disk = [ "phy:/dev/HostVG/XenGuest2,hda,w", "file:/root/boot.iso&test,hdc:cdrom,r" ]
+disk = [ "phy:/dev/HostVG/XenGuest2,hda,w", "file:/root/boot.iso&test,hdc:cdrom,r", """phy:/dev/HostVG/XenGuest'",hdb,w""" ]
 vif = [ "mac=00:16:3e:66:92:9c,bridge=xenbr1,script=vif-bridge,model=e1000,type=ioemu" ]
 parallel = "none"
 serial = "none"
diff --git a/tests/xmconfigdata/test-escape-paths.xml b/tests/xmconfigdata/test-escape-paths.xml
index dabf492..13e6e29 100644
--- a/tests/xmconfigdata/test-escape-paths.xml
+++ b/tests/xmconfigdata/test-escape-paths.xml
@@ -31,6 +31,11 @@
       <target dev='hdc' bus='ide'/>
       <readonly/>
     </disk>
+    <disk type='block' device='disk'>
+      <driver name='phy'/>
+      <source dev='/dev/HostVG/XenGuest&apos;&quot;'/>
+      <target dev='hdb' bus='ide'/>
+    </disk>
     <interface type='bridge'>
       <mac address='00:16:3e:66:92:9c'/>
       <source bridge='xenbr1'/>
-- 
1.7.3.2

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


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]