]> git.ipfire.org Git - thirdparty/libvirt.git/commit
virXMLFormatMetadata: Don't modify deprecated 'xmlIndentTreeOutput'
authorPeter Krempa <pkrempa@redhat.com>
Mon, 10 Nov 2025 15:52:45 +0000 (16:52 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 11 Nov 2025 20:30:06 +0000 (21:30 +0100)
commit05baaddb3fc08010bccf2ee73bc465d288205901
treeaa99d2f9787c810b96bc3ae42846dba80fb5cad7
parentf307c7dc0cdb5880fe75a4b0dab3cc76dc7b047e
virXMLFormatMetadata: Don't modify deprecated 'xmlIndentTreeOutput'

'libxml2' deprecated the 'xmlIndentTreeOutput' thread-local variable as
well as the 'xmlThrDefIndentTreeOutput' function for setting the global
default, which we use in our code for formatting the metadata sub-XML.

'libxml2' also for now doesn't provide a way to set target indentation
level in 'xmlSaveCtxt' which would allow us to use the modern output
APIs, we can't replace our use of 'xmlDumpNode'. (See
https://gitlab.gnome.org/GNOME/libxml2/-/issues/989 )

Since the indentation is enabled by default in libxml2 and our most
commonly used code which calls xmlDumpNode lives in a standalone
process, where we don't override the setting, just removing the override
will result in identical behaviour.

For the use cases which do live in a process we don't fully control and
thus the default could have been overriden, the result would be that the
<metadata> element would be un-indented, but that is still valid XML.

Thus to fix the deprecated use just stop setting 'xmlIndentTreeOutput'.

Closes: https://gitlab.com/libvirt/libvirt/-/issues/816
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
src/util/virxml.c