From nobody Sun Nov 15 00:25:56 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) client-ip=38.145.34.151; 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 38.145.34.151 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=1794595900; cv=none; d=zohomail.com; s=zohoarc; b=oKyRog6fBU2spZTZXIMN+zAvYVOmTRLbCQmSBEGdZOvFastUC27atJYbLHazKOXn73UCk1UyX3INfOuBzg0S5GyaAcoD2KnlPSE4eE/RaOIs0aYVGp6mdkZh0fFANWt1GfphRkXCv11csfFqOwsxMR9/p8k5BNAk6Nvek0vVcIk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794595900; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Subject:Subject:To:To:Message-Id:Cc; bh=4PCmW8DF7s6/Dsr/+GEtSuI81MQSbMtbvyHB74tQlYM=; b=PU8zo6HcSscYoFMHXcV7xV+vJ65uxfTdJSfDurB/14DauAYerILPskTGYfnI5EtII+aiTeslCQtzeJPzCPEJSfWp8EA4FUoGCt5/qeW/bKnasd5yuBClrNAlXSm5M6IcJs1OWxdtu3NlklWkD2Ji8R8+ZR56gpn5Vt3uVZPiVSA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 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 [38.145.34.151]) by mx.zohomail.com with SMTPS id 179459590025677.94377401901806; Fri, 13 Nov 2026 10:51:40 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id E3BDB41B6B; Fri, 13 Nov 2026 13:51:38 -0500 (EST) Received: from [172.19.199.25] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id D257241BF8; Fri, 13 Nov 2026 13:50:34 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id 59E5F3F292; Fri, 13 Nov 2026 13:50:26 -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 161693F308 for ; Fri, 13 Nov 2026 13:50:24 -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-414-UA7hYwW1NjKmV08b0zNCbg-1; Fri, 13 Nov 2026 13:50:23 -0500 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (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 4550E1955DC6 for ; Fri, 13 Nov 2026 18:50:22 +0000 (UTC) Received: from mprivozn-thinkpadt14gen4.redhat.corp (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id BB22618004FF for ; Fri, 13 Nov 2026 18:50:21 +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=-0.1 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,RCVD_IN_SBL_CSS,SPF_HELO_PASS autolearn=no autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1794595824; 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; bh=4PCmW8DF7s6/Dsr/+GEtSuI81MQSbMtbvyHB74tQlYM=; b=NxMhc8oDfIws2OJqSLzGS97/nyGlz0P8PlP2MCUDSb/gMUD4JINYo0nywIv4aiXkQmNX8g q2aY0yRYyqgUjKdfQHU10mNbdzFavKuYUFcILoVoKK6PW5YPLIkkHLGt2qTTsCiSeNZNQS vDxm4MyV1vUeR45tzNwgNVn7uI1ltQU= X-MC-Unique: UA7hYwW1NjKmV08b0zNCbg-1 X-Mimecast-MFC-AGG-ID: UA7hYwW1NjKmV08b0zNCbg_1794595822 To: devel@lists.libvirt.org Subject: [PATCH] virusbmock: Mock virFileCanonicalizePath() Date: Fri, 13 Nov 2026 19:50:06 +0100 Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: eN4UNPWxgYp3LdLHkhtgXzJsH9e2moXj5IfLTxKsNeQ_1794595822 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: P34XVLM3PVE4JSXK5AGGR37YPFNK7KIB X-Message-ID-Hash: P34XVLM3PVE4JSXK5AGGR37YPFNK7KIB X-MailFrom: mprivozn@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: Michal Privoznik via Devel Reply-To: Michal Privoznik X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1794595904930158500 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Michal Privoznik After previous commit the virt-aa-helper-test started failing. This is because the previous commit introduced mocking for access() in such way that for any path with "/dev/bus/usb" prefix zero value is returned (meaning the file exists). But later, when virt-aa-helper tries to call virFileCanonicalizePath() over such path it gets an error resulting in failed test case. Therefore, mock also virFileCanonicalizePath() and make it just return the same path for aforementioned case. Signed-off-by: Michal Privoznik --- Pushed as trivial and 'fix the broken build'. tests/virusbmock.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/tests/virusbmock.c b/tests/virusbmock.c index c67a0ba307..17fa735360 100644 --- a/tests/virusbmock.c +++ b/tests/virusbmock.c @@ -27,6 +27,7 @@ #include =20 #include "virmock.h" +#include "virfile.h" =20 #define USB_SYSFS "/sys/bus/usb" #define FAKE_USB_SYSFS "virusbtestdata/sys_bus_usb" @@ -43,6 +44,7 @@ static int (*real___open_2)(const char *path, int flags); #endif static DIR *(*real_opendir)(const char *name); static int (*real_access)(const char *path, int mode); +static char *(*real_virFileCanonicalizePath)(const char *path); =20 static void init_syms(void) { @@ -59,6 +61,7 @@ static void init_syms(void) #endif VIR_MOCK_REAL_INIT(opendir); VIR_MOCK_REAL_INIT(access); + VIR_MOCK_REAL_INIT(virFileCanonicalizePath); } =20 static char *get_fake_path(const char *real_path) @@ -95,7 +98,7 @@ int access(const char *path, int mode) * device that is meant to be inaccessible in the current mount namesp= ace * (as happens inside a container). This lets us exercise the code pa= th * without shipping empty device-node files. */ - if (STRPREFIX(path, USB_DEVFS)) { + if (STRSKIP(path, USB_DEVFS)) { if (STREQ(path, INACCESSIBLE_USB_NODE)) { errno =3D ENOENT; return -1; @@ -106,6 +109,20 @@ int access(const char *path, int mode) return real_access(path, mode); } =20 +char * +virFileCanonicalizePath(const char *path) +{ + init_syms(); + + /* Since we pretend any /dev/bus/usb node exists (see access() above) = we + * must also make sure to return an expected value here. */ + if (STRPREFIX(path, USB_DEVFS)) { + return g_strdup(path); + } + + return real_virFileCanonicalizePath(path); +} + int open(const char *pathname, int flags, ...) { g_autofree char *path =3D NULL; --=20 2.56.0