From nobody Tue Feb 10 01:20:06 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1618476124; cv=none; d=zohomail.com; s=zohoarc; b=XWqhj178ETzB6YiTjMgHFHsk8bfdJR4dXMxAPu7uty1yKNK/27VeJAGAAcB6yghjyFpBNd/7TxAVBFvHe7n+bbfpkgUOSU+XeZvAoauiTgJhSqVymXubnIJUTfbAAmd2Cp7cuycm7j5wFWLhVNfwyhYn76F2ZU6HGWyNLuczyG8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618476124; h=Content-Type:Content-Transfer-Encoding:Cc: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=DM1ORXv/yuKOcv5igCLzDe8urcvI5sBvlJ7OKIwaMok=; b=EOsxk9OXclEcoWdS6FBFwHl/LR4WAREx1VjUldJX1pn6yX++FMcO6j3orj6Mfdk7fv0ehrxwNI2gvFt2836EzhwKXvn6cqHPHT+8AkTqTQCBbsg9rJv7jfibocUB5j1l5/YLC9uylC/t6GFtfb2+7hpBgHdAVjNySygo8wv7usk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1618476124791688.7762900169845; Thu, 15 Apr 2021 01:42:04 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-579-bA7tBCvMP_GkFaMGE-NASw-1; Thu, 15 Apr 2021 04:41:08 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 18D6418B9ED1; Thu, 15 Apr 2021 08:41:03 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DD7B910016DB; Thu, 15 Apr 2021 08:41:02 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 9DB0D1806D18; Thu, 15 Apr 2021 08:41:02 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13F8f051021243 for ; Thu, 15 Apr 2021 04:41:00 -0400 Received: by smtp.corp.redhat.com (Postfix) id E0E7E5D76F; Thu, 15 Apr 2021 08:41:00 +0000 (UTC) Received: from work.redhat.com (ovpn-114-212.ams2.redhat.com [10.36.114.212]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3473362462; Thu, 15 Apr 2021 08:41:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618476123; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=DM1ORXv/yuKOcv5igCLzDe8urcvI5sBvlJ7OKIwaMok=; b=OPQir+lstZQRtcj5tsp9X9D/2XDdwGKE6uWfm8BNoMO0fZ8q/MjvRg1ebACZejCg6+IaKg g66NjJl2yNUsmwT79F6P6NlF+5vQk1W6Y+vqhUvMMIvFI9epaMkYbFvu71fJrr8nsktzgc l9IYiGZ1yU44PyJ/whaSDE7rFMuoTCo= X-MC-Unique: bA7tBCvMP_GkFaMGE-NASw-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 2/2] virCPUDefParseXML: Log schema validation errors Date: Thu, 15 Apr 2021 10:40:54 +0200 Message-Id: <20210415084054.9971-3-twiederh@redhat.com> In-Reply-To: <20210415084054.9971-1-twiederh@redhat.com> References: <20210415084054.9971-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Schema validation was only performed if the "validateXML" flag was set. Make invalid XML visible in the logs by always validating, but only treat validation errors as errors if said flag is set. Signed-off-by: Tim Wiederhake --- src/conf/cpu_conf.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c index c095ab0e89..c584b0f360 100644 --- a/src/conf/cpu_conf.c +++ b/src/conf/cpu_conf.c @@ -329,6 +329,7 @@ virCPUDefParseXML(xmlXPathContextPtr ctxt, VIR_XPATH_NODE_AUTORESTORE(ctxt) int n; size_t i; + g_autofree char *schemafile =3D NULL; g_autofree char *cpuMode =3D NULL; g_autofree char *fallback =3D NULL; g_autofree char *vendor_id =3D NULL; @@ -347,16 +348,13 @@ virCPUDefParseXML(xmlXPathContextPtr ctxt, return -1; } =20 - if (validateXML) { - g_autofree char *schemafile =3D NULL; - - if (!(schemafile =3D virFileFindResource("cpu.rng", - abs_top_srcdir "/docs/schem= as", - PKGDATADIR "/schemas"))) - return -1; + if (!(schemafile =3D virFileFindResource("cpu.rng", + abs_top_srcdir "/docs/schemas", + PKGDATADIR "/schemas"))) + return -1; =20 - if (virXMLValidateNodeAgainstSchema(schemafile, ctxt->doc, - ctxt->node) < 0) + if (virXMLValidateNodeAgainstSchema(schemafile, ctxt->node) < 0) { + if (validateXML) return -1; } =20 --=20 2.26.2