From 21108d37a38df978a7986e72312cfc7002f71aa8 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Thu, 18 Nov 2010 17:35:23 -0500 Subject: [PATCH] conf: Fix parsing python style triple quotes An incorrect check broke matching the closing set of quotes. Update tests to cover this case for XM config files. --- 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 a31bbc4f03..d9a7603342 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 f9f2cb859d..e3e6db9b34 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 dabf4928f3..13e6e2986e 100644 --- a/tests/xmconfigdata/test-escape-paths.xml +++ b/tests/xmconfigdata/test-escape-paths.xml @@ -31,6 +31,11 @@ + + + + + -- GitLab