summaryrefslogtreecommitdiff
path: root/gnu/packages/patches/libxml2-terminating-newline.patch
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/patches/libxml2-terminating-newline.patch')
-rw-r--r--gnu/packages/patches/libxml2-terminating-newline.patch33
1 files changed, 33 insertions, 0 deletions
diff --git a/gnu/packages/patches/libxml2-terminating-newline.patch b/gnu/packages/patches/libxml2-terminating-newline.patch
new file mode 100644
index 0000000000..3f5c88dd4e
--- /dev/null
+++ b/gnu/packages/patches/libxml2-terminating-newline.patch
@@ -0,0 +1,33 @@
+Fix a regression in 2.9.12 where serializing empty HTML documents would
+not add a terminating newline.
+
+ https://gitlab.gnome.org/GNOME/libxml2/-/issues/266
+
+Taken from upstream:
+
+ https://gitlab.gnome.org/GNOME/libxml2/-/commit/92d9ab4c28842a09ca2b76d3ff2f933e01b6cd6f
+
+diff --git a/HTMLtree.c b/HTMLtree.c
+--- a/HTMLtree.c
++++ b/HTMLtree.c
+@@ -763,11 +763,15 @@ htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
+ if (((xmlDocPtr) cur)->intSubset != NULL) {
+ htmlDtdDumpOutput(buf, (xmlDocPtr) cur, NULL);
+ }
+- /* Always validate cur->parent when descending. */
+- if ((cur->parent == parent) && (cur->children != NULL)) {
+- parent = cur;
+- cur = cur->children;
+- continue;
++ if (cur->children != NULL) {
++ /* Always validate cur->parent when descending. */
++ if (cur->parent == parent) {
++ parent = cur;
++ cur = cur->children;
++ continue;
++ }
++ } else {
++ xmlOutputBufferWriteString(buf, "\n");
+ }
+ break;
+