Fix xmlNodeDumpOutputInternal regression (#1965662)

This commit is contained in:
David King 2021-05-29 09:50:06 +01:00
parent 9dbfe838fa
commit fbd491af9d
2 changed files with 52 additions and 1 deletions

View File

@ -0,0 +1,46 @@
From 13ad8736d294536da4cbcd70a96b0a2fbf47070c Mon Sep 17 00:00:00 2001
From: Nick Wellnhofer <wellnhofer@aevum.de>
Date: Tue, 25 May 2021 10:55:25 +0200
Subject: [PATCH] Fix regression in xmlNodeDumpOutputInternal
Commit 85b1792e could cause additional whitespace if xmlNodeDump was
called with a non-zero starting level.
---
xmlsave.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/xmlsave.c b/xmlsave.c
index aedbd5e7..489505f4 100644
--- a/xmlsave.c
+++ b/xmlsave.c
@@ -890,6 +890,13 @@ xmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) {
break;
case XML_ELEMENT_NODE:
+ if ((cur != root) && (ctxt->format == 1) &&
+ (xmlIndentTreeOutput))
+ xmlOutputBufferWrite(buf, ctxt->indent_size *
+ (ctxt->level > ctxt->indent_nr ?
+ ctxt->indent_nr : ctxt->level),
+ ctxt->indent);
+
/*
* Some users like lxml are known to pass nodes with a corrupted
* tree structure. Fall back to a recursive call to handle this
@@ -900,13 +907,6 @@ xmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) {
break;
}
- if ((ctxt->level > 0) && (ctxt->format == 1) &&
- (xmlIndentTreeOutput))
- xmlOutputBufferWrite(buf, ctxt->indent_size *
- (ctxt->level > ctxt->indent_nr ?
- ctxt->indent_nr : ctxt->level),
- ctxt->indent);
-
xmlOutputBufferWrite(buf, 1, "<");
if ((cur->ns != NULL) && (cur->ns->prefix != NULL)) {
xmlOutputBufferWriteString(buf, (const char *)cur->ns->prefix);
--
GitLab

View File

@ -1,6 +1,6 @@
Name: libxml2
Version: 2.9.12
Release: 3%{?dist}
Release: 4%{?dist}
Summary: Library providing XML and HTML support
License: MIT
@ -16,6 +16,8 @@ Patch0: libxml2-multilib.patch
Patch1: libxml2-2.9.8-python3-unicode-errors.patch
# https://gitlab.gnome.org/GNOME/libxml2/-/issues/255
Patch2: libxml2-2.9.12-fix-lxml-corrupted-tree.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1965662
Patch3: libxml2-2.9.12-fix-formatting-regression.patch
BuildRequires: cmake-rpm-macros
BuildRequires: gcc
@ -146,6 +148,9 @@ gzip -9 -c doc/libxml2-api.xml > doc/libxml2-api.xml.gz
%{python3_sitearch}/libxml2mod.so
%changelog
* Sat May 29 2021 David King <amigadave@amigadave.com> - 2.9.12-4
- Fix xmlNodeDumpOutputInternal regression (#1965662)
* Tue May 25 2021 David King <amigadave@amigadave.com> - 2.9.12-3
- Fix multiarch conflict in devel subpackage