From nobody Mon Feb 9 03:20:02 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1664872419; cv=none; d=zohomail.com; s=zohoarc; b=lZhbrO7/c1byvLLCUklX6ruTY6pq03FdA6bTxfqlFpn3AzTG7lurDCVjm2GYkaxvDfCTS7qa3pKeuNF5sQfP/sHwYv+85XMJOol7S2T+4akg0/brW0XiLNYbMh4A5usJVlJL7+YXfVOnpL/MJSuh5hFpmosa2HK99oipuKklrsg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1664872419; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=oDyJxfVYYtr1Fc6VwJpKKjCf/Gd40fT6q+NciQ6v04s=; b=CxsJioIvAEgaCwWoQ5LdnfXlBzkfDjII0+xAl+py+OjO+C9zRS62XLf4LCfDAUwnPuq+uuZkESNMG+sDBAwc8DIwJXutkTRb5sri8Ct264RokEFgHDdNJ7fFgv2C+pZSrcve0X19RpL6VyVb3VBeS0wKE1RyCvBznMTvoPuSqbo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1664872419674614.2696181135276; Tue, 4 Oct 2022 01:33:39 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-219-iaJ7fY2EN2OzZawM_vIuAg-1; Tue, 04 Oct 2022 04:33:36 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7EDA918A0678; Tue, 4 Oct 2022 08:33:33 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 54510C15E76; Tue, 4 Oct 2022 08:33:33 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 0336B1947043; Tue, 4 Oct 2022 08:33:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 2EC951946A4A for ; Tue, 4 Oct 2022 08:33:31 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 2359840C6EC3; Tue, 4 Oct 2022 08:33:31 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 91EDD40C6EC2 for ; Tue, 4 Oct 2022 08:33:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664872418; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=oDyJxfVYYtr1Fc6VwJpKKjCf/Gd40fT6q+NciQ6v04s=; b=Nk9yQ8ID+Kq9ElZE7QIphtQnGVy5dyy8DVQFkTgsJFHRAtz2rlInclbtnOPq4feAIOsYvV TmfAc2YyDiYVRgEMHCHyY5qkovLJ9jvftb0RRDf96XfPfgCqgJCX1XQtozbehtY57PdKtN H4U8hPP4qyS2vEfoS8Tm6SRjAjmroHo= X-MC-Unique: iaJ7fY2EN2OzZawM_vIuAg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 13/43] testParseXMLDocFromFile: Validate that the replaced node is identical with parsed root Date: Tue, 4 Oct 2022 10:32:47 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1664872421194100006 Content-Type: text/plain; charset="utf-8" When replacing a definition node by contents of a file the root node in the file must match the replaced node. Enforce that by passing the original node name as the 'rootnode' argument of virXMLParse. Signed-off-by: Peter Krempa --- src/test/test_driver.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 26c6c95c28..5eae22f591 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -851,7 +851,8 @@ testParseXMLDocFromFile(xmlNodePtr node, g_autofree char *absFile =3D testBuildFilename(file, relFile); xmlNodePtr newnode =3D NULL; - if (!(doc =3D virXMLParse(absFile, NULL, NULL, NULL, NULL, NULL, f= alse))) + if (!(doc =3D virXMLParse(absFile, NULL, NULL, (const char *) node= ->name, + NULL, NULL, false))) return NULL; if (!(newnode =3D xmlCopyNode(xmlDocGetRootElement(doc), 1))) { --=20 2.37.3