]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virshtest: Don't use both '--xml' and '--shell' for 'virsh echo'
authorPeter Krempa <pkrempa@redhat.com>
Wed, 11 Aug 2021 09:03:59 +0000 (11:03 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 18 Aug 2021 09:07:25 +0000 (11:07 +0200)
Escaping for both shell and XML makes no sense. Use one at time so that
we can forbid use of both.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
tests/virshtest.c

index 53db2aa19acc772979e019d321bb431a8f9f79bf..07c27428aefb6af2b6a02c7b3ec80234f2ae53a6 100644 (file)
@@ -432,9 +432,8 @@ mymain(void)
     DO_TEST(15, "a A 0 + * ; . &apos; &quot; / ? =   \n &lt; &gt; &amp;\n",
             "echo", "--xml", "a", "A", "0", "+", "*", ";", ".", "'", "\"",
             "/", "?", "=", " ", "\n", "<", ">", "&");
-    DO_TEST(16, "a A 0 + '*' ';' . '&apos;' '&quot;' / '?' = ' ' '\n' '&lt;'"
-            " '&gt;' '&amp;'\n",
-            "echo", "--shell", "--xml", "a", "A", "0", "+", "*", ";", ".", "'",
+    DO_TEST(16, "a A 0 + '*' ';' . ''\\''' '\"' / '?' = ' ' '\n' '<' '>' '&'\n",
+            "echo", "--shell", "a", "A", "0", "+", "*", ";", ".", "\'",
             "\"", "/", "?", "=", " ", "\n", "<", ">", "&");
     DO_TEST(17, "\n",
             "echo", "");
@@ -443,7 +442,7 @@ mymain(void)
     DO_TEST(19, "\n",
             "echo", "--xml", "");
     DO_TEST(20, "''\n",
-            "echo", "--xml", "--shell", "");
+            "echo", "--shell", "");
     DO_TEST(21, "\n",
             "echo ''");
     DO_TEST(22, "''\n",
@@ -451,7 +450,7 @@ mymain(void)
     DO_TEST(23, "\n",
             "echo --xml ''");
     DO_TEST(24, "''\n",
-            "echo --xml --shell \"\"''");
+            "echo --shell \"\"''");
 
     /* Tests of -- handling.  */
     DO_TEST(25, "a\n",