From nobody Fri Nov 14 16:52:16 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1761855356; cv=none; d=zohomail.com; s=zohoarc; b=AwPcfnjknzd2+dKEq4BwdxPHnpYzlKimzeni7/HX6eyaRTB6SDYbNyA0oDEPiOfy4kgI9tJqB60NvdmicMtXvcIAVa9CyqxNy2/LlQbzw+5LMNfF6l+tdPQUj/IhLs4YmdFlkNcRbL4BwhPFFSCpUjrB+IhGJNuyEIKxylyLulg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761855356; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=FNRZt8jiMGXVRM9MBgJ5gyia098sWupMtwtZcP0XKbo=; b=Pl6qtCfek8qMs0x8weAez7rEFATbfr8/NWKT4cD6IsrAYzk0gCtDSMhdcgVHbckg3y+AyxqAa/J4kQM1lwi4geYThlF6fL/V5MzoySnVv7x7rlQJ7DKSO9KHnC4rgzqHbLi4RAnK49RVmG64xk4RQ858cB3AhCudNLvXUkVKh6A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 176185535614397.60011129469387; Thu, 30 Oct 2025 13:15:56 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vEZ2D-0005TW-At; Thu, 30 Oct 2025 16:14:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vEZ20-0005RR-BU for qemu-devel@nongnu.org; Thu, 30 Oct 2025 16:14:03 -0400 Received: from forwardcorp1a.mail.yandex.net ([2a02:6b8:c0e:500:1:45:d181:df01]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vEZ1l-0002zT-Gw for qemu-devel@nongnu.org; Thu, 30 Oct 2025 16:13:58 -0400 Received: from mail-nwsmtp-smtp-corp-main-66.iva.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-66.iva.yp-c.yandex.net [IPv6:2a02:6b8:c0c:1a8f:0:640:2fa2:0]) by forwardcorp1a.mail.yandex.net (Yandex) with ESMTPS id E6A81C00F5; Thu, 30 Oct 2025 23:13:32 +0300 (MSK) Received: from vsementsov-lin.. (unknown [2a02:6bf:8080:861::1:2b]) by mail-nwsmtp-smtp-corp-main-66.iva.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id VDmLnP0FIqM0-7VUKEBAb; Thu, 30 Oct 2025 23:13:32 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1761855212; bh=FNRZt8jiMGXVRM9MBgJ5gyia098sWupMtwtZcP0XKbo=; h=Message-ID:Date:Cc:Subject:To:From; b=Ve8ioeN77khigmTRN6HZPrxfoCmq1LMNl4PWR9K7CFBVLlMgnQZXxu1fzTPhsfL5X /T/uVwPVhap1HLJrajZ1sJXtvWpEGXPNS4RZcdxZvcvTrLiBRV+nkjQIza3BBg12eR 60bSrU0BToGYihZCzUcW5Ajq/KROwdcFtuSm+FUY= Authentication-Results: mail-nwsmtp-smtp-corp-main-66.iva.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: peter.maydell@linaro.org Cc: berrange@redhat.com, qemu-devel@nongnu.org, Vladimir Sementsov-Ogievskiy Subject: [PATCH] scripts/checkpatch.pl: remove bogus patch prefix warning Date: Thu, 30 Oct 2025 23:13:19 +0300 Message-ID: <20251030201319.858480-1-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.48.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a02:6b8:c0e:500:1:45:d181:df01; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1a.mail.yandex.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1761855361112154100 Content-Type: text/plain; charset="utf-8" Remove the 'patch prefix exists, appears to be a -p0 patch' warning entirely as it is fundamentally flawed and can only produce false positives. Sometimes I create test files with names 'a' and 'b', and then get surprised seeing this warning. It was not easy to understand where it comes from. How it works: 1. It extracts prefixes (a/, b/) from standard diff output 2. Checks if files/directories with these names exist in the project root 3. Warns if they exist, claiming it's a '-p0 patch' issue This logic is wrong because: - Standard diff/patch tools always use a/ and b/ prefixes by default - The existence of files named 'a' or 'b' in the working directory is completely unrelated to patch format - The working directory state may not correspond to the patch content (different commits, branches, etc.) - In QEMU project, there are no single-letter files/directories in root, so this check can only generate false positives The correct way to detect -p0 patches would be to analyze the path format within the patch itself (e.g., absolute paths or paths without prefixes), not check filesystem state. So, let's finally drop it. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Daniel P. Berrang=C3=A9 --- scripts/checkpatch.pl | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index d3d75f3f13..d0f4537f25 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -1741,13 +1741,7 @@ sub process { } } elsif ($line =3D~ /^\+\+\+\s+(\S+)/) { $realfile =3D $1; - $realfile =3D~ s@^([^/]*)/@@ if (!$file); - - $p1_prefix =3D $1; - if (!$file && $tree && $p1_prefix ne '' && - -e "$root/$p1_prefix") { - WARN("patch prefix '$p1_prefix' exists, appears to be a -p0 patch\n"); - } + $realfile =3D~ s@^[^/]*/@@ if (!$file); =20 if (defined $fileinfo && !$fileinfo->{isgit}) { $fileinfo->{lineend} =3D $oldhere; --=20 2.48.1