From nobody Fri Nov 21 10:18:01 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1762791799; cv=none; d=zohomail.com; s=zohoarc; b=evW7rj+rbIm8s9x/58i5eLjxeE6kP1J9Xw11z8IL7cLqgfjOnUSxmosH1Csq65w2n0Gj+da5bgKfD2AeywiatUY1jvfe9OV76BueVQputC0Mp9UUvtVmdl+tMAEVfDnjx+AtjX6vuz92xSpv4ln/ohliZkEz6ZlOB08aNQWmr+4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762791799; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=2ink6hzaX3ZJmopdPRMu2f9gMIMV2fZFWMYAMbcFynU=; b=OdVMjKWSSJGSUGWEgRfBt76SQ/0plFRZPlwxSSa22PTTKZ5WzhFjOURjTI4hsn7CiiKjNOgjIPJGKNOJn828wdhobb5zV3lY2WIEIdsen4LdyyluCjudfWsxALGn1q0/n6J9vuxMuWLeOSY87dogE4bY8XFrbqqi6qQrzdRnIp8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1762791799439157.8156871572179; Mon, 10 Nov 2025 08:23:19 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id 6540A4496C; Mon, 10 Nov 2025 11:23:18 -0500 (EST) Received: from [172.19.199.29] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id B973F44B74; Mon, 10 Nov 2025 11:21:09 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id 3AAA844974; Mon, 10 Nov 2025 11:20:35 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 6965944964 for ; Mon, 10 Nov 2025 11:20:34 -0500 (EST) Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-684-VLEuBlm5NwWSgHQ-cQvwUA-1; Mon, 10 Nov 2025 11:20:32 -0500 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 965ED1935319 for ; Mon, 10 Nov 2025 16:20:30 +0000 (UTC) Received: from speedmetal.openshiftapps.com (unknown [10.44.22.4]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id CAC7630001B9 for ; Mon, 10 Nov 2025 16:20:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1762791634; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2ink6hzaX3ZJmopdPRMu2f9gMIMV2fZFWMYAMbcFynU=; b=fuQIP1q/WAYzKd8W2RqIIU5M1JfguiNpHzf3LyRH0N9mIXRqi7gIaBfXNiZosVGwGH5uJA DN3iP9Ee7YmBy9laov76otandl6Fm1b+UPYQiZvE5IAFfjAqG2ANBcqNhjxDcHLnpDtBoA myU6cqBoZiXhCTpxJzvH5vjPMMjqt5k= X-MC-Unique: VLEuBlm5NwWSgHQ-cQvwUA-1 X-Mimecast-MFC-AGG-ID: VLEuBlm5NwWSgHQ-cQvwUA_1762791630 To: devel@lists.libvirt.org Subject: [PATCH 2/2] virXMLFormatMetadata: Don't modify deprecated 'xmlIndentTreeOutput' Date: Mon, 10 Nov 2025 17:20:25 +0100 Message-ID: <09407d278e792c3b1504df44a2f2d937cd6f61f5.1762791538.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: fDvPCtcqjubSDyeQ9eJ6dmD0XASOlBDbpCJAi7tNUs0_1762791630 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: KHTHZHHYBSHD4U5EQML42ZYVV7DFPSKX X-Message-ID-Hash: KHTHZHHYBSHD4U5EQML42ZYVV7DFPSKX X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Peter Krempa via Devel Reply-To: Peter Krempa X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1762791802951158500 Content-Type: text/plain; charset="utf-8" From: Peter Krempa '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'. Since the indentation is enabled by default in libxml2 and most of our code using xmlDumpNode (notably except for the 'test' driver and embedded qemu driver uses) is in standalone processes, which didn't change the default, just removing the override will result in identical behaviour. For the two exeptions, the result of changing the default would be that the part 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 --- src/util/virxml.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/util/virxml.c b/src/util/virxml.c index 44f11accf3..77c7b5a8f4 100644 --- a/src/util/virxml.c +++ b/src/util/virxml.c @@ -1920,23 +1920,14 @@ virXMLFormatMetadata(virBuffer *buf, { g_autoptr(xmlBuffer) xmlbuf =3D NULL; const char *xmlbufContent =3D NULL; - int oldIndentTreeOutput =3D xmlIndentTreeOutput; if (!metadata) return 0; - /* Indentation on output requires that we previously set - * xmlKeepBlanksDefault to 0 when parsing; also, libxml does 2 - * spaces per level of indentation of intermediate elements, - * but no leading indentation before the starting element. - * Thankfully, libxml maps what looks like globals into - * thread-local uses, so we are thread-safe. */ - xmlIndentTreeOutput =3D 1; xmlbuf =3D virXMLBufferCreate(); if (xmlNodeDump(xmlbuf, metadata->doc, metadata, virBufferGetIndent(buf) / 2, 1) < 0) { - xmlIndentTreeOutput =3D oldIndentTreeOutput; virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Unable to format metadata element")); return -1; @@ -1948,7 +1939,6 @@ virXMLFormatMetadata(virBuffer *buf, virSkipSpaces(&xmlbufContent); virBufferAsprintf(buf, "%s\n", xmlbufContent); - xmlIndentTreeOutput =3D oldIndentTreeOutput; return 0; } --=20 2.51.1