Re: Use \if/\endif to remove non-libxml2 expected output in regression tests
От
Tom Lane
Тема
Re: Use \if/\endif to remove non-libxml2 expected output in regression tests
Дата
Msg-id
1767619.1781306488@sss.pgh.pa.us
Ответ на
Список
Дерево обсуждения
Use \if/\endif to remove non-libxml2 expected output in regression tests Michael Paquier <michael@paquier.xyz>
Re: Use \if/\endif to remove non-libxml2 expected output in regression tests Daniel Gustafsson <daniel@yesql.se>
Re: Use \if/\endif to remove non-libxml2 expected output in regression tests Tom Lane <tgl@sss.pgh.pa.us>
Re: Use \if/\endif to remove non-libxml2 expected output in regression tests Tom Lane <tgl@sss.pgh.pa.us>
Re: Use \if/\endif to remove non-libxml2 expected output in regression tests Tom Lane <tgl@sss.pgh.pa.us>
Re: Use \if/\endif to remove non-libxml2 expected output in regression tests Michael Paquier <michael@paquier.xyz>
Re: Use \if/\endif to remove non-libxml2 expected output in regression tests Tom Lane <tgl@sss.pgh.pa.us>
Re: Use \if/\endif to remove non-libxml2 expected output in regression tests Michael Paquier <michael@paquier.xyz>
Re: Use \if/\endif to remove non-libxml2 expected output in regression tests Tom Lane <tgl@sss.pgh.pa.us>
Re: Use \if/\endif to remove non-libxml2 expected output in regression tests Michael Paquier <michael@paquier.xyz>
Re: Use \if/\endif to remove non-libxml2 expected output in regression tests Tom Lane <tgl@sss.pgh.pa.us>
Re: Use \if/\endif to remove non-libxml2 expected output in regression tests Michael Paquier <michael@paquier.xyz>
I wrote:
> It's kind of sad that this issue is still present in the wild ten
> years later. But anyway, I wonder if we could dodge the issue
> simply by modifying these error-provoking cases to have some
> whitespace at the end of the XML input? I don't think I have
> a problematic version of libxml2 to test that with, though.
Hah, this idea does mostly work. Finding that no system I had at
hand had a libxml2 old enough to exhibit the problem, I installed
libxml2 2.9.3 from source. (That's the first version containing
the problematic CVE fix, and it does behave as xml_2.out expects.)
I found that four of the inconsistent messages could be fixed this
way. The other three problem cases have input like 'one');
INSERT INTO xmltest VALUES (2, 'two');
-INSERT INTO xmltest VALUES (3, 'two ');
ERROR: invalid XML content
-LINE 1: INSERT INTO xmltest VALUES (3, 'two ');
^
-DETAIL: line 1: Couldn't find end of Start Tag wrong line 1
-two
+ ^
SELECT * FROM xmltest;
id | data
----+--------------------
@@ -89,13 +89,13 @@ SELECT xmlconcat(1, 2);
ERROR: argument of XMLCONCAT must be type xml, not type integer
LINE 1: SELECT xmlconcat(1, 2);
^
-SELECT xmlconcat('bad', ' ');
ERROR: invalid XML content
-LINE 1: SELECT xmlconcat('bad', ' ');
^
-DETAIL: line 1: Couldn't find end of Start Tag syntax line 1
-
+ ^
SELECT xmlconcat('', NULL, '');
xmlconcat
--------------
@@ -271,13 +271,13 @@ SELECT xmlparse(content '');
(1 row)
-SELECT xmlparse(content '&idontexist;');
+SELECT xmlparse(content '&idontexist; ');
ERROR: invalid XML content
DETAIL: line 1: Entity 'idontexist' not defined
-&idontexist;
+&idontexist;
^
line 1: Opening and ending tag mismatch: twoerrors line 1 and unbalanced
-&idontexist;
+&idontexist;
^
SELECT xmlparse(content '');
xmlparse
@@ -285,11 +285,11 @@ SELECT xmlparse(content '');
(1 row)
-SELECT xmlparse(document ' ');
+SELECT xmlparse(document '!');
ERROR: invalid XML document
DETAIL: line 1: Start tag expected, '<' not found
-
- ^
+!
+^
SELECT xmlparse(document 'abc');
ERROR: invalid XML document
DETAIL: line 1: Start tag expected, '<' not found
@@ -301,21 +301,21 @@ SELECT xmlparse(document 'x');
x
(1 row)
-SELECT xmlparse(document '&');
+SELECT xmlparse(document '& ');
ERROR: invalid XML document
DETAIL: line 1: xmlParseEntityRef: no name
-&
+&
^
line 1: Opening and ending tag mismatch: invalidentity line 1 and abc
-&
+&
^
-SELECT xmlparse(document '&idontexist;');
+SELECT xmlparse(document '&idontexist; ');
ERROR: invalid XML document
DETAIL: line 1: Entity 'idontexist' not defined
-&idontexist;
+&idontexist;
^
line 1: Opening and ending tag mismatch: undefinedentity line 1 and abc
-&idontexist;
+&idontexist;
^
SELECT xmlparse(document '');
xmlparse
@@ -329,13 +329,13 @@ SELECT xmlparse(document '');
(1 row)
-SELECT xmlparse(document '&idontexist;');
+SELECT xmlparse(document '&idontexist; ');
ERROR: invalid XML document
DETAIL: line 1: Entity 'idontexist' not defined
-&idontexist;
+&idontexist;
^
line 1: Opening and ending tag mismatch: twoerrors line 1 and unbalanced
-&idontexist;
+&idontexist;
^
SELECT xmlparse(document '');
xmlparse
diff --git a/src/test/regress/sql/xml.sql b/src/test/regress/sql/xml.sql
index 2b8445e499e..0366b776119 100644
--- a/src/test/regress/sql/xml.sql
+++ b/src/test/regress/sql/xml.sql
@@ -5,7 +5,7 @@ CREATE TABLE xmltest (
INSERT INTO xmltest VALUES (1, 'one');
INSERT INTO xmltest VALUES (2, 'two');
-INSERT INTO xmltest VALUES (3, 'two ');
SELECT * FROM xmltest;
@@ -30,7 +30,7 @@ SELECT xmlconcat(xmlcomment('hello'),
SELECT xmlconcat('hello', 'you');
SELECT xmlconcat(1, 2);
-SELECT xmlconcat('bad', ' ');
SELECT xmlconcat('', NULL, '');
SELECT xmlconcat('', NULL, '');
SELECT xmlconcat(NULL);
@@ -75,17 +75,17 @@ SELECT xmlparse(content '&');
SELECT xmlparse(content '&idontexist;');
SELECT xmlparse(content '');
SELECT xmlparse(content '');
-SELECT xmlparse(content '&idontexist;');
+SELECT xmlparse(content '&idontexist; ');
SELECT xmlparse(content '');
-SELECT xmlparse(document ' ');
+SELECT xmlparse(document '!');
SELECT xmlparse(document 'abc');
SELECT xmlparse(document 'x');
-SELECT xmlparse(document '&');
-SELECT xmlparse(document '&idontexist;');
+SELECT xmlparse(document '& ');
+SELECT xmlparse(document '&idontexist; ');
SELECT xmlparse(document '');
SELECT xmlparse(document '');
-SELECT xmlparse(document '&idontexist;');
+SELECT xmlparse(document '&idontexist; ');
SELECT xmlparse(document '');
В списке pgsql-hackers по дате отправления