From nobody Mon Feb 9 16:51:21 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.120 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=1571827413; cv=none; d=zoho.com; s=zohoarc; b=famGXdrITXvaaiXdhYfDuSgKof/N95co/4BhWkqhdPzYgWYSBbSgzXO+faEZC9WgUSUTUOU9vDsKq1p8cS5dcbI//FaRjBK7s//G9Vh525Mad8/1VhXHHHJifukHbBAl0vounnSqj5+SpkMW7twxqe6s8s3PMo7EYBj6OOyzAX0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571827413; 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=ppQxKv8YodbF/ouiu43fLblRm1jMrEZJkiLrfGgxStA=; b=PELZcz1GWa36tH48L82/noKMV9Dw+eKai2GCoOwSOmXAG+4Jtr3sOUjZfEMqQpZJFmN2kPmlPO99EP0yAhRc0FV9QImI63PuTUNJv9roCsMFNW4nKdupKxpz1a4OypYIetiNF1LSVJq10T1M5GlVCZ1JuTCJu9XszYBAUG6e12k= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 157182741392725.227934669477804; Wed, 23 Oct 2019 03:43:33 -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-224-R2sGEZiHPnauH4ybf2_gSQ-1; Wed, 23 Oct 2019 06:43:31 -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 3303D47B; Wed, 23 Oct 2019 10:43:26 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 08D7F1001E75; Wed, 23 Oct 2019 10:43:26 +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 BDBB94EDA5; Wed, 23 Oct 2019 10:43:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9NAhFRI020244 for ; Wed, 23 Oct 2019 06:43:15 -0400 Received: by smtp.corp.redhat.com (Postfix) id EC46360E1C; Wed, 23 Oct 2019 10:43:15 +0000 (UTC) Received: from kinshicho.redhat.com (unknown [10.40.205.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 53933BAA4 for ; Wed, 23 Oct 2019 10:43:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571827412; 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=ppQxKv8YodbF/ouiu43fLblRm1jMrEZJkiLrfGgxStA=; b=X3DKdbNUZ97RMVR44KNqaSImak+rExZreB2kgNWFzO3JpWSAY8a4t9F2q0ueDCqV8D2LYS HNEEsCpPP/K2ULJ1dipW3tISazjNtae9l8DYfG4RoAm7zSWOVAMb6+oEFc9E27Kl3kyaXB TuL/G5m2AtQVfb9atXFa4irXHCnkTi4= From: Andrea Bolognani To: libvir-list@redhat.com Date: Wed, 23 Oct 2019 12:42:52 +0200 Message-Id: <20191023104302.26669-3-abologna@redhat.com> In-Reply-To: <20191023104302.26669-1-abologna@redhat.com> References: <20191023104302.26669-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 02/12] tests: testQemuCapsIterate: Don't ignore malformed file names 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 X-MC-Unique: R2sGEZiHPnauH4ybf2_gSQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" If files whose name doesn't follow the expected format are added to the repository, it's better to make the test suite fail than to silently ignore them. Signed-off-by: Andrea Bolognani --- tests/testutilsqemu.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c index 0faa9cb84a..7a2ea3bf4e 100644 --- a/tests/testutilsqemu.c +++ b/tests/testutilsqemu.c @@ -910,7 +910,7 @@ testQemuCapsIterate(const char *suffix, goto cleanup; =20 while ((rc =3D virDirRead(dir, &ent, TEST_QEMU_CAPS_PATH)) > 0) { - char *tmp =3D ent->d_name; + g_autofree char *tmp =3D g_strdup(ent->d_name); char *base =3D NULL; char *archName =3D NULL; =20 @@ -918,9 +918,11 @@ testQemuCapsIterate(const char *suffix, if (!virStringStripSuffix(tmp, suffix)) continue; =20 - /* Find the last dot, moving on if none is present */ - if (!(archName =3D strrchr(tmp, '.'))) - continue; + /* Find the last dot */ + if (!(archName =3D strrchr(tmp, '.'))) { + VIR_TEST_VERBOSE("malformed file name '%s'", ent->d_name); + goto cleanup; + } =20 /* The base name is everything before the last dot, and * the architecture name everything after it */ --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list