From nobody Tue Dec 16 02:14:55 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1747674719; cv=none; d=zohomail.com; s=zohoarc; b=HbSgN5KvXZSdFW+luqh9JO4FJQv/2o02TNJolwtje/vCVO6bJKKksYhQQc76S2gkU+g6M/WGBBnsJNJ3KcFqDZnKRGoUzDM4Wq4nN2JF4+a4bNfh5gQke3MZ3D4MSCWccZyP9LApdC9IhakcKQZfTjOoPqk388UNbiF6pYDYASI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1747674719; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=QlUv3WXzN1tjBcwFhwjIM/PQQRTgeOpjkK85tto1bTY=; b=J715uzQolZH/0jvkohtqvLpjU9nUwImr2gHV0YrVSWz9TnIOsgy/ofk83fDZlln+/j9wj/ea0yQqngzn5GVJprUDrFmU+RWkS7lpm7rFgl+XO1DzL7yRE7zoPLYjqxbaRs0R05TaunHYIULIWVjAk9q2IWR00YoS4RBA9WYZ1YE= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1747674719676232.8572090493882; Mon, 19 May 2025 10:11:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uH40M-0005tn-Kh; Mon, 19 May 2025 13:10:22 -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 1uH40H-0005rN-Ld for qemu-devel@nongnu.org; Mon, 19 May 2025 13:10:18 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uH40F-0001XY-Md for qemu-devel@nongnu.org; Mon, 19 May 2025 13:10:17 -0400 Received: from mx-prod-mc-05.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-461-yy3-RrAFOUGFeL2JY56mcg-1; Mon, 19 May 2025 13:10:11 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A21A31956080; Mon, 19 May 2025 17:10:10 +0000 (UTC) Received: from toolbx.redhat.com (unknown [10.42.28.50]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B900C19560AA; Mon, 19 May 2025 17:10:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1747674614; h=from:from: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; bh=QlUv3WXzN1tjBcwFhwjIM/PQQRTgeOpjkK85tto1bTY=; b=BYsXrOGx+XiFDqoMNtv9xCaZ8RtDiqhNpgavK8WbqHVspC/wCIv2s5qkcPgRi+UDMl/rva XemsevTk8nbX2/JynPNx3lsutg0SzhzgmZyL6j8W2afGQd3nlWO3hmi8mPI22s3Yotcn1X qoSTsHDlJaAUBdaGkxcxJJ5davdvE2A= X-MC-Unique: yy3-RrAFOUGFeL2JY56mcg-1 X-Mimecast-MFC-AGG-ID: yy3-RrAFOUGFeL2JY56mcg_1747674610 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Peter Maydell , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PATCH v5 1/9] Revert "scripts: mandate that new files have SPDX-License-Identifier" Date: Mon, 19 May 2025 18:09:56 +0100 Message-ID: <20250519171004.352636-2-berrange@redhat.com> In-Reply-To: <20250519171004.352636-1-berrange@redhat.com> References: <20250519171004.352636-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=170.10.129.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.13, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=-1, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, 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 @redhat.com) X-ZM-MESSAGEID: 1747674720691116600 This reverts commit fa4d79c64dae03ffa269e42e21822453856618b7. The logic in this commit was flawed in two critical ways * It always failed to report SPDX validation on the last newly added file. IOW, it only worked if at least 2 new files were added in a commit * If an existing file change, followed a new file change, in the commit and the existing file context/changed lines included SPDX-License-Identifier, it would incorrectly associate this with the previous newly added file. Simply reverting this commit will make it significantly easier to understand the improved logic in the following commit. Reported-by: Peter Maydell Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Peter Maydell Signed-off-by: Daniel P. Berrang=C3=A9 --- scripts/checkpatch.pl | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 365892de04..d355c0dad5 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -1442,8 +1442,6 @@ sub process { my $in_imported_file =3D 0; my $in_no_imported_file =3D 0; my $non_utf8_charset =3D 0; - my $expect_spdx =3D 0; - my $expect_spdx_file; =20 our @report =3D (); our $cnt_lines =3D 0; @@ -1681,34 +1679,6 @@ sub process { WARN("added, moved or deleted file(s), does MAINTAINERS need updating?\= n" . $herecurr); } =20 -# All new files should have a SPDX-License-Identifier tag - if ($line =3D~ /^new file mode\s*\d+\s*$/) { - if ($expect_spdx) { - if ($expect_spdx_file =3D~ - /\.(c|h|py|pl|sh|json|inc|Makefile)$/) { - # source code files MUST have SPDX license declared - ERROR("New file '$expect_spdx_file' requires " . - "'SPDX-License-Identifier'"); - } else { - # Other files MAY have SPDX license if appropriate - WARN("Does new file '$expect_spdx_file' need " . - "'SPDX-License-Identifier'?"); - } - } - $expect_spdx =3D 1; - $expect_spdx_file =3D undef; - } elsif ($expect_spdx) { - $expect_spdx_file =3D $realfile unless - defined $expect_spdx_file; - - # SPDX tags may occurr in comments which were - # stripped from '$line', so use '$rawline' - if ($rawline =3D~ /SPDX-License-Identifier/) { - $expect_spdx =3D 0; - $expect_spdx_file =3D undef; - } - } - # Check SPDX-License-Identifier references a permitted license if ($rawline =3D~ m,SPDX-License-Identifier: (.*?)(\*/)?\s*$,) { &checkspdx($realfile, $1); --=20 2.49.0 From nobody Tue Dec 16 02:14:55 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1747674667; cv=none; d=zohomail.com; s=zohoarc; b=GrVNXv8tSlxeaZOz7az67DD1r5YTw0k6OZZ/QjMCLaO+XFD8ikMX3K0h9AJHKT0pX7Oq70Z0DFB95K7gNyEj5rcY1n3Q1wvJLww86PjjQn/Pyesdh+Bzk+DoLMu9ZeU8NkLibTInyHvfomCG34GxJOyodyKphRwx+j6vpvc4zL8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1747674667; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=6D5RyZES2SWDQ6wNrdDFXxlCfksypSEuA8DR7Bwa5jE=; b=S0Gs34uUshhV26SPGhUgwZUHxLLjrEhyjkBESoflgcSy68oBVmaiBuZYWo/T3CxTQnXetsbqvnHeAXw/+pWXFbG7KYXNIKiuzmpo/SqfVW2hAktLCmkPASPuxCcW31inYByk/W2EI8BOdKlbTaMzCo+w+A3pF7o+09UkWJp765g= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1747674667760363.35288819926757; Mon, 19 May 2025 10:11:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uH40S-0005xq-N2; Mon, 19 May 2025 13:10:28 -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 1uH40R-0005xb-G5 for qemu-devel@nongnu.org; Mon, 19 May 2025 13:10:27 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uH40P-0001Yz-Ga for qemu-devel@nongnu.org; Mon, 19 May 2025 13:10:27 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-134-T0qTIJatMUe-Pi-fWyzZUQ-1; Mon, 19 May 2025 13:10:18 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2ECB21800875; Mon, 19 May 2025 17:10:13 +0000 (UTC) Received: from toolbx.redhat.com (unknown [10.42.28.50]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 3441819560AA; Mon, 19 May 2025 17:10:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1747674624; h=from:from: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; bh=6D5RyZES2SWDQ6wNrdDFXxlCfksypSEuA8DR7Bwa5jE=; b=OcIVVQXRUw21wcAWIKWfs4/P368ehY+r17tF/wmrsf/S5O4Z9ZoUAkZExVzHyb48YluGOh kMclCC2MAgSQ2pk4kyn956RzDi9p2xrIY6NHNVEsMB3qWJDtcBDsd2ZCFjz61aAVP51ji2 Uv71eo3ubrRxQtUqDT1niXMI8FFzkIM= X-MC-Unique: T0qTIJatMUe-Pi-fWyzZUQ-1 X-Mimecast-MFC-AGG-ID: T0qTIJatMUe-Pi-fWyzZUQ_1747674613 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Peter Maydell , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PATCH v5 2/9] scripts/checkpatch.pl: fix various indentation mistakes Date: Mon, 19 May 2025 18:09:57 +0100 Message-ID: <20250519171004.352636-3-berrange@redhat.com> In-Reply-To: <20250519171004.352636-1-berrange@redhat.com> References: <20250519171004.352636-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=170.10.133.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.13, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=-1, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, 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 @redhat.com) X-ZM-MESSAGEID: 1747674670545116600 Various checks in the code were under-indented relative to other surrounding code. Some places used 4-space indents instead of single tab, while other places simply used too few tabs. Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Peter Maydell Signed-off-by: Daniel P. Berrang=C3=A9 --- scripts/checkpatch.pl | 98 +++++++++++++++++++++---------------------- 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index d355c0dad5..7675418b0b 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -1681,19 +1681,19 @@ sub process { =20 # Check SPDX-License-Identifier references a permitted license if ($rawline =3D~ m,SPDX-License-Identifier: (.*?)(\*/)?\s*$,) { - &checkspdx($realfile, $1); + &checkspdx($realfile, $1); } =20 if ($rawline =3D~ m,(SPDX-[a-zA-Z0-9-_]+):,) { - my $tag =3D $1; - my @permitted =3D qw( - SPDX-License-Identifier - ); - - unless (grep { /^$tag$/ } @permitted) { - ERROR("Tag $tag not permitted in QEMU code, valid " . - "choices are: " . join(", ", @permitted)); - } + my $tag =3D $1; + my @permitted =3D qw( + SPDX-License-Identifier + ); + + unless (grep { /^$tag$/ } @permitted) { + ERROR("Tag $tag not permitted in QEMU code, valid " . + "choices are: " . join(", ", @permitted)); + } } =20 # Check for wrappage within a valid hunk of the file @@ -2274,7 +2274,7 @@ sub process { =20 # missing space after union, struct or enum definition if ($line =3D~ /^.\s*(?:typedef\s+)?(enum|union|struct)(?:\s+$Ident)?(?:= \s+$Ident)?[=3D\{]/) { - ERROR("missing space after $1 definition\n" . $herecurr); + ERROR("missing space after $1 definition\n" . $herecurr); } =20 # check for spacing round square brackets; allowed: @@ -2569,7 +2569,7 @@ sub process { =20 if ($line =3D~ /^.\s*(Q(?:S?LIST|SIMPLEQ|TAILQ)_HEAD)\s*\(\s*[^,]/ && $line !~ /^.typedef/) { - ERROR("named $1 should be typedefed separately\n" . $herecurr); + ERROR("named $1 should be typedefed separately\n" . $herecurr); } =20 # Need a space before open parenthesis after if, while etc @@ -3118,48 +3118,48 @@ sub process { =20 # Qemu error function tests =20 - # Find newlines in error messages - my $qemu_error_funcs =3D qr{error_setg| - error_setg_errno| - error_setg_win32| - error_setg_file_open| - error_set| - error_prepend| - warn_reportf_err| - error_reportf_err| - error_vreport| - warn_vreport| - info_vreport| - error_report| - warn_report| - info_report| - g_test_message}x; - - if ($rawline =3D~ /\b(?:$qemu_error_funcs)\s*\(.*\".*\\n/) { - ERROR("Error messages should not contain newlines\n" . $herecurr); - } + # Find newlines in error messages + my $qemu_error_funcs =3D qr{error_setg| + error_setg_errno| + error_setg_win32| + error_setg_file_open| + error_set| + error_prepend| + warn_reportf_err| + error_reportf_err| + error_vreport| + warn_vreport| + info_vreport| + error_report| + warn_report| + info_report| + g_test_message}x; + + if ($rawline =3D~ /\b(?:$qemu_error_funcs)\s*\(.*\".*\\n/) { + ERROR("Error messages should not contain newlines\n" . $herecurr); + } =20 - # Continue checking for error messages that contains newlines. This - # check handles cases where string literals are spread over multiple line= s. - # Example: - # error_report("Error msg line #1" - # "Error msg line #2\n"); - my $quoted_newline_regex =3D qr{\+\s*\".*\\n.*\"}; - my $continued_str_literal =3D qr{\+\s*\".*\"}; + # Continue checking for error messages that contains newlines. This + # check handles cases where string literals are spread over multiple lin= es. + # Example: + # error_report("Error msg line #1" + # "Error msg line #2\n"); + my $quoted_newline_regex =3D qr{\+\s*\".*\\n.*\"}; + my $continued_str_literal =3D qr{\+\s*\".*\"}; =20 - if ($rawline =3D~ /$quoted_newline_regex/) { - # Backtrack to first line that does not contain only a quoted literal - # and assume that it is the start of the statement. - my $i =3D $linenr - 2; + if ($rawline =3D~ /$quoted_newline_regex/) { + # Backtrack to first line that does not contain only a quoted literal + # and assume that it is the start of the statement. + my $i =3D $linenr - 2; =20 - while (($i >=3D 0) & $rawlines[$i] =3D~ /$continued_str_literal/) { - $i--; - } + while (($i >=3D 0) & $rawlines[$i] =3D~ /$continued_str_literal/) { + $i--; + } =20 - if ($rawlines[$i] =3D~ /\b(?:$qemu_error_funcs)\s*\(/) { - ERROR("Error messages should not contain newlines\n" . $herecurr); + if ($rawlines[$i] =3D~ /\b(?:$qemu_error_funcs)\s*\(/) { + ERROR("Error messages should not contain newlines\n" . $herecurr); + } } - } =20 # check for non-portable libc calls that have portable alternatives in QEMU if ($line =3D~ /\bffs\(/) { --=20 2.49.0 From nobody Tue Dec 16 02:14:55 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1747674705; cv=none; d=zohomail.com; s=zohoarc; b=R1PCzGo0zXGwZBm0y4TD5DS+htWtvnRWt6AJ/WoDyU8YJdFP6EWEFCA55OZQ2hcYzPKva/ExUc2r5akpC2JHlmtvOMcP8UYNlpi9bKHSfiYZskaMLXJwy5AvSgPRdjAI4/nMclNiFCFi5UYEX4LZ/C4Y3nigNfpXpmqYnLIOx4Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1747674705; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=KWHP90eJKf02CTAZoqxu4x58UKkV50XNU1BADJ5KN6w=; b=R9TGHfGM1yBvMswlzaAea5eRQXHnHMCkaKpnNTqFu6IYWF8z8hRPaEwl0OjJUSXxUPl5LhKRDqg1hN7ToyjYCyQzLQYEvVZczdzR1ydriLO1O33DQAr/R6POa4k0cSiPOd8ZOy3igXPJVZEnBj0jzv1xYjCH2vRrWOusRVqrO5o= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1747674705428442.1569399214385; Mon, 19 May 2025 10:11:45 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uH40O-0005vb-HI; Mon, 19 May 2025 13:10:24 -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 1uH40M-0005te-B4 for qemu-devel@nongnu.org; Mon, 19 May 2025 13:10:22 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uH40K-0001YA-Fr for qemu-devel@nongnu.org; Mon, 19 May 2025 13:10:22 -0400 Received: from mx-prod-mc-01.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-332-SvzqFbXzPk2QLayFPodb8Q-1; Mon, 19 May 2025 13:10:16 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A1B2119560AD; Mon, 19 May 2025 17:10:15 +0000 (UTC) Received: from toolbx.redhat.com (unknown [10.42.28.50]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id A760919560AE; Mon, 19 May 2025 17:10:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1747674619; h=from:from: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; bh=KWHP90eJKf02CTAZoqxu4x58UKkV50XNU1BADJ5KN6w=; b=H/ad9R22P9OqLfBnj1SHVN0yEbyDhSt3rQYKdzU4s4hcB9SxKGzuxaz8rGrjip24E74MQr rnlUsp8cKwxYRV4dJXUtUVd+MCNWh4JIiealOPLnfo5aeh6tyCeU4RTJsNJRTaVcPvxeRJ RxTQCmJzorpyg84ckJP0bfLBOSdp5uU= X-MC-Unique: SvzqFbXzPk2QLayFPodb8Q-1 X-Mimecast-MFC-AGG-ID: SvzqFbXzPk2QLayFPodb8Q_1747674615 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Peter Maydell , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PATCH v5 3/9] scripts/checkpatch: introduce tracking of file start/end Date: Mon, 19 May 2025 18:09:58 +0100 Message-ID: <20250519171004.352636-4-berrange@redhat.com> In-Reply-To: <20250519171004.352636-1-berrange@redhat.com> References: <20250519171004.352636-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=170.10.133.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.13, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=-1, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, 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 @redhat.com) X-ZM-MESSAGEID: 1747674706672116600 Some checks want to be performed either at the start of a new file within a patch, or at the end. This is complicated by the fact that the information relevant to the check may be spread across multiple lines. It is further complicated by a need to support both git and non-git diffs, and special handling for renames where there might not be any patch hunks. To handle this more sanely, introduce explicit tracking of file start/end, taking account of git metadata, and calling a hook function at each transition. Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Peter Maydell Signed-off-by: Daniel P. Berrang=C3=A9 --- scripts/checkpatch.pl | 110 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 107 insertions(+), 3 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 7675418b0b..82056dcd24 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -1417,6 +1417,39 @@ sub checkspdx { } } =20 +# All three of the methods below take a 'file info' record +# which is a hash ref containing +# +# 'isgit': 1 if an enhanced git diff or 0 for a plain diff +# 'githeader': 1 if still parsing git patch header, 0 otherwise +# 'linestart': line number of start of file diff +# 'lineend': line number of end of file diff +# 'filenew': the new filename +# 'fileold': the old filename (same as 'new filename' except +# for renames in git diffs) +# 'action': one of 'modified' (always) or 'new' or 'deleted' or +# 'renamed' (git diffs only) +# 'mode': file mode for new/deleted files (git diffs only) +# 'similarity': file similarity when renamed (git diffs only) +# 'facts': hash ref for storing any metadata related to checks +# + +# Called at the end of each patch, with the list of +# real filenames that were seen in the patch +sub process_file_list { + my @fileinfos =3D @_; +} + +# Called at the start of processing a diff hunk for a file +sub process_start_of_file { + my $fileinfo =3D shift; +} + +# Called at the end of processing a diff hunk for a file +sub process_end_of_file { + my $fileinfo =3D shift; +} + sub process { my $filename =3D shift; =20 @@ -1453,7 +1486,10 @@ sub process { my $realfile =3D ''; my $realline =3D 0; my $realcnt =3D 0; + my $fileinfo; + my @fileinfolist; my $here =3D ''; + my $oldhere =3D ''; my $in_comment =3D 0; my $comment_edge =3D 0; my $first_line =3D 0; @@ -1591,17 +1627,56 @@ sub process { $prefix =3D "$filename:$realline: " if ($emacs && $file); $prefix =3D "$filename:$linenr: " if ($emacs && !$file); =20 + $oldhere =3D $here; $here =3D "#$linenr: " if (!$file); $here =3D "#$realline: " if ($file); =20 # extract the filename as it passes - if ($line =3D~ /^diff --git.*?(\S+)$/) { - $realfile =3D $1; - $realfile =3D~ s@^([^/]*)/@@ if (!$file); + if ($line =3D~ /^diff --git\s+(\S+)\s+(\S+)$/) { + my $fileold =3D $1; + my $filenew =3D $2; + + if (defined $fileinfo) { + $fileinfo->{lineend} =3D $oldhere; + process_end_of_file($fileinfo) + } + $fileold =3D~ s@^([^/]*)/@@ if (!$file); + $filenew =3D~ s@^([^/]*)/@@ if (!$file); + $realfile =3D $filenew; checkfilename($realfile, \$acpi_testexpected, \$acpi_nont= estexpected); + + $fileinfo =3D { + "isgit" =3D> 1, + "githeader" =3D> 1, + "linestart" =3D> $here, + "lineend" =3D> 0, + "fileold" =3D> $fileold, + "filenew" =3D> $filenew, + "action" =3D> "modified", + "mode" =3D> 0, + "similarity" =3D> 0, + "facts" =3D> {}, + }; + push @fileinfolist, $fileinfo; + } elsif (defined $fileinfo && $fileinfo->{githeader} && + $line =3D~ /^(new|deleted) (?:file )?mode\s+([0-7]+)$/) { + $fileinfo->{action} =3D $1; + $fileinfo->{mode} =3D oct($2); + } elsif (defined $fileinfo && $fileinfo->{githeader} && + $line =3D~ /^similarity index (\d+)%/) { + $fileinfo->{similarity} =3D int($1); + } elsif (defined $fileinfo && $fileinfo->{githeader} && + $line =3D~ /^rename (from|to) [\w\/\.\-]+\s*$/) { + $fileinfo->{action} =3D "renamed"; + # For a no-change rename, we'll never have any "+++..." + # lines, so trigger actions now + if ($1 eq "to" && $fileinfo->{similarity} =3D=3D 100) { + process_start_of_file($fileinfo); + } } elsif ($line =3D~ /^\+\+\+\s+(\S+)/) { $realfile =3D $1; $realfile =3D~ s@^([^/]*)/@@ if (!$file); + checkfilename($realfile, \$acpi_testexpected, \$acpi_nont= estexpected); =20 $p1_prefix =3D $1; @@ -1610,6 +1685,30 @@ sub process { WARN("patch prefix '$p1_prefix' exists, appears to be a -p0 patch\n"); } =20 + if (defined $fileinfo && !$fileinfo->{isgit}) { + $fileinfo->{lineend} =3D $oldhere; + process_end_of_file($fileinfo); + } + + if (!defined $fileinfo || !$fileinfo->{isgit}) { + $fileinfo =3D { + "isgit" =3D> 0, + "githeader" =3D> 0, + "linestart" =3D> $here, + "lineend" =3D> 0, + "fileold" =3D> $realfile, + "filenew" =3D> $realfile, + "action" =3D> "modified", + "mode" =3D> 0, + "similarity" =3D> 0, + "facts" =3D> {}, + }; + push @fileinfolist, $fileinfo; + } else { + $fileinfo->{githeader} =3D 0; + } + process_start_of_file($fileinfo); + next; } =20 @@ -3213,6 +3312,11 @@ sub process { } } =20 + if (defined $fileinfo) { + process_end_of_file($fileinfo); + } + process_file_list(@fileinfolist); + if ($is_patch && $chk_signoff && $signoff =3D=3D 0) { ERROR("Missing Signed-off-by: line(s)\n"); } --=20 2.49.0 From nobody Tue Dec 16 02:14:55 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1747674710; cv=none; d=zohomail.com; s=zohoarc; b=VcIuDtEkN2AMuQOQXm6luveQ1GFD9RciRoD8oEXTV/HAfYNSUXf5U6vuZJg5HhYy4N6XNqAKEw9Ft91fq0riayyngRglmUQpIzD1prupDmLIe2r1tW5O/15KigduYeBPl/FCM4bhbC/8zvnguZn8bM29NCSCyNzVjoJ21AJ2WdY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1747674710; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=AcM26vXczQLNBJGv0uqc1uZ7aik0JS+BDC4m3OHXOGM=; b=RKB8dIq37ETC1w1iX9chwHa6/j+oAzkasZKSTQCHYV2cztmCK7oHozOAte6wRca663mg+L52LV+GHxHhULydZBbce6z7pIGMYhQxxOkyw2wFSjzHEoHXNRLiD30J3zz0R/u46nCnXimI/wZyX/k2I7HZcZG5Ub/zwye2mR+y0YA= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1747674710119647.4088971739433; Mon, 19 May 2025 10:11:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uH40Q-0005wq-KV; Mon, 19 May 2025 13:10:26 -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 1uH40O-0005vr-SR for qemu-devel@nongnu.org; Mon, 19 May 2025 13:10:25 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uH40M-0001Ya-Tm for qemu-devel@nongnu.org; Mon, 19 May 2025 13:10:24 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-59-8MekADBVN5eAwhWqFHD9bw-1; Mon, 19 May 2025 13:10:19 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id DDC05180048E; Mon, 19 May 2025 17:10:17 +0000 (UTC) Received: from toolbx.redhat.com (unknown [10.42.28.50]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 3993619560AA; Mon, 19 May 2025 17:10:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1747674621; h=from:from: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; bh=AcM26vXczQLNBJGv0uqc1uZ7aik0JS+BDC4m3OHXOGM=; b=SpZHdEX677wkzHhQkHeY6EEk4yayp1/1KWHDQwZ0HZRN3zwn/fOmv+gqcfASMOcY8l/5Yo jufAeHnDlyRlC/HYqolWYv/WeHoL9UaW+KBeMHhA8dRRoV9gg8HdSjiwO4O9u977JwPmOv Ibc73KJZKUfk3D9wxJbtR9JiYrFwjeg= X-MC-Unique: 8MekADBVN5eAwhWqFHD9bw-1 X-Mimecast-MFC-AGG-ID: 8MekADBVN5eAwhWqFHD9bw_1747674618 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Peter Maydell , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH v5 4/9] scripts/checkpatch: use new hook for ACPI test data check Date: Mon, 19 May 2025 18:09:59 +0100 Message-ID: <20250519171004.352636-5-berrange@redhat.com> In-Reply-To: <20250519171004.352636-1-berrange@redhat.com> References: <20250519171004.352636-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=170.10.129.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.13, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=-1, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, 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 @redhat.com) X-ZM-MESSAGEID: 1747674712769116600 The ACPI test data check needs to analyse a list of all files in a commit, so can use the new hook for processing the file list. Reviewed-by: Peter Maydell Signed-off-by: Daniel P. Berrang=C3=A9 --- scripts/checkpatch.pl | 61 ++++++++++++++++++++----------------------- 1 file changed, 29 insertions(+), 32 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 82056dcd24..60c26dca06 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -1330,29 +1330,6 @@ sub WARN { } } =20 -# According to tests/qtest/bios-tables-test.c: do not -# change expected file in the same commit with adding test -sub checkfilename { - my ($name, $acpi_testexpected, $acpi_nontestexpected) =3D @_; - - # Note: shell script that rebuilds the expected files is in the sa= me - # directory as files themselves. - # Note: allowed diff list can be changed both when changing expect= ed - # files and when changing tests. - if ($name =3D~ m#^tests/data/acpi/# and not $name =3D~ m#^\.sh$#) { - $$acpi_testexpected =3D $name; - } elsif ($name !~ m#^tests/qtest/bios-tables-test-allowed-diff.h$#) { - $$acpi_nontestexpected =3D $name; - } - if (defined $$acpi_testexpected and defined $$acpi_nontestexpected) { - ERROR("Do not add expected files together with tests, " . - "follow instructions in " . - "tests/qtest/bios-tables-test.c: both " . - $$acpi_testexpected . " and " . - $$acpi_nontestexpected . " found\n"); - } -} - sub checkspdx { my ($file, $expr) =3D @_; =20 @@ -1438,6 +1415,34 @@ sub checkspdx { # real filenames that were seen in the patch sub process_file_list { my @fileinfos =3D @_; + + # According to tests/qtest/bios-tables-test.c: do not + # change expected file in the same commit with adding test + my @acpi_testexpected; + my @acpi_nontestexpected; + + foreach my $fileinfo (@fileinfos) { + # Note: shell script that rebuilds the expected files is in + # the same directory as files themselves. + # Note: allowed diff list can be changed both when changing + # expected files and when changing tests. + if ($fileinfo->{filenew} =3D~ m#^tests/data/acpi/# && + $fileinfo->{filenew} !~ m#^\.sh$#) { + push @acpi_testexpected, $fileinfo->{filenew}; + } elsif ($fileinfo->{filenew} !~ + m#^tests/qtest/bios-tables-test-allowed-diff.h$#) { + push @acpi_nontestexpected, $fileinfo->{filenew}; + } + } + if (int(@acpi_testexpected) > 0 and int(@acpi_nontestexpected) > 0) { + ERROR("Do not add expected files together with tests, " . + "follow instructions in " . + "tests/qtest/bios-tables-test.c. Files\n\n " . + join("\n ", @acpi_testexpected) . + "\n\nand\n\n " . + join("\n ", @acpi_nontestexpected) . + "\n\nfound in the same patch\n"); + } } =20 # Called at the start of processing a diff hunk for a file @@ -1502,9 +1507,6 @@ sub process { my %suppress_whiletrailers; my %suppress_export; =20 - my $acpi_testexpected; - my $acpi_nontestexpected; - # Pre-scan the patch sanitizing the lines. =20 sanitise_line_reset(); @@ -1643,7 +1645,6 @@ sub process { $fileold =3D~ s@^([^/]*)/@@ if (!$file); $filenew =3D~ s@^([^/]*)/@@ if (!$file); $realfile =3D $filenew; - checkfilename($realfile, \$acpi_testexpected, \$acpi_nont= estexpected); =20 $fileinfo =3D { "isgit" =3D> 1, @@ -1677,8 +1678,6 @@ sub process { $realfile =3D $1; $realfile =3D~ s@^([^/]*)/@@ if (!$file); =20 - checkfilename($realfile, \$acpi_testexpected, \$acpi_nont= estexpected); - $p1_prefix =3D $1; if (!$file && $tree && $p1_prefix ne '' && -e "$root/$p1_prefix") { @@ -1771,9 +1770,7 @@ sub process { $line =3D~ /^rename (?:from|to) [\w\/\.\-]+\s*$/ || ($line =3D~ /\{\s*([\w\/\.\-]*)\s*\=3D\>\s*([\w\/\.\-]*)\s*\}/ && (defined($1) || defined($2)))) && - !(($realfile ne '') && - defined($acpi_testexpected) && - ($realfile eq $acpi_testexpected))) { + $realfile !~ m#^tests/data/acpi/#) { $reported_maintainer_file =3D 1; WARN("added, moved or deleted file(s), does MAINTAINERS need updating?\= n" . $herecurr); } --=20 2.49.0 From nobody Tue Dec 16 02:14:55 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1747674725; cv=none; d=zohomail.com; s=zohoarc; b=Uy8f4q7EIUR38GPyoIEafP0Bxme+hqGNhJL/1enocBQtyfs4sn15WiR/6WEJe3XyMR43HBiWFVfk+eYEN2/n+dq53waJSeDh+zEKKDeB37kDyQWMn47zAmdbn1ksonqkI7QjB2RY1wuBYUSFhv50JiwO4ZZgQnOLu6wVeB3V9tM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1747674725; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=h+dWRobRDbXf8iBk4tZlIYJHZdaGNMwO4PK4On7eRJ8=; b=TWN5jKPNrXTzz4Zbmv6FbxDywLn+2l0aqmrtxxMiCzwlMp81omzwGsRIen+nc43nffariKRDHZGYGzaiVWeq+e62QQydUGy+ZKvpMQoBT3t+l29rukSY/CV6VdzwsPON/ADATmLKU4OCKGqn7wSueO+SCNTqU4JvhJ9gEjUxKOA= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1747674725252616.8917945965233; Mon, 19 May 2025 10:12:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uH40V-0005yO-Cy; Mon, 19 May 2025 13:10:31 -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 1uH40S-0005xr-SG for qemu-devel@nongnu.org; Mon, 19 May 2025 13:10:28 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uH40R-0001Z6-AO for qemu-devel@nongnu.org; Mon, 19 May 2025 13:10:28 -0400 Received: from mx-prod-mc-01.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-460-a_vdsorfMC-nZ1Yg15S06Q-1; Mon, 19 May 2025 13:10:22 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3DA7C195609F; Mon, 19 May 2025 17:10:20 +0000 (UTC) Received: from toolbx.redhat.com (unknown [10.42.28.50]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 47CFF19560AA; Mon, 19 May 2025 17:10:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1747674626; h=from:from: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; bh=h+dWRobRDbXf8iBk4tZlIYJHZdaGNMwO4PK4On7eRJ8=; b=B1nCmwJ8HTvPei6rvG98OiPzP7a/w5pnwDkQSZNCppYGLzieZg1SUzH6t85mgsOkSgbjiF h+T6HylqNih9ju3fd9phnmsTK8+sLWUy1oSoyuD+YedLCt+c4Pu+X5jJYu8V1yMo0YVXuH I04vn6gtCMQ49vHvOSA7KlcgRc0y/Y0= X-MC-Unique: a_vdsorfMC-nZ1Yg15S06Q-1 X-Mimecast-MFC-AGG-ID: a_vdsorfMC-nZ1Yg15S06Q_1747674621 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Peter Maydell , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PATCH v5 5/9] scripts/checkpatch: use new hook for file permissions check Date: Mon, 19 May 2025 18:10:00 +0100 Message-ID: <20250519171004.352636-6-berrange@redhat.com> In-Reply-To: <20250519171004.352636-1-berrange@redhat.com> References: <20250519171004.352636-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=170.10.133.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.13, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=-1, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, 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 @redhat.com) X-ZM-MESSAGEID: 1747674729108116600 The file permissions check is the kind of check intended to be performed in the new start of file hook. Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Peter Maydell Signed-off-by: Daniel P. Berrang=C3=A9 --- scripts/checkpatch.pl | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 60c26dca06..e208222e75 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -1448,6 +1448,17 @@ sub process_file_list { # Called at the start of processing a diff hunk for a file sub process_start_of_file { my $fileinfo =3D shift; + + # Check for incorrect file permissions + if ($fileinfo->{action} eq "new" && ($fileinfo->{mode} & 0111)) { + my $permhere =3D $fileinfo->{linestart} . "FILE: " . + $fileinfo->{filenew} . "\n"; + if ($fileinfo->{filenew} =3D~ + /(\bMakefile(?:\.objs)?|\.(c|cc|cpp|h|mak|s|S))$/) { + ERROR("do not set execute permissions for source " . + "files\n" . $permhere); + } + } } =20 # Called at the end of processing a diff hunk for a file @@ -1719,14 +1730,6 @@ sub process { =20 $cnt_lines++ if ($realcnt !=3D 0); =20 -# Check for incorrect file permissions - if ($line =3D~ /^new (file )?mode.*[7531]\d{0,2}$/) { - my $permhere =3D $here . "FILE: $realfile\n"; - if ($realfile =3D~ /(\bMakefile(?:\.objs)?|\.c|\.cc|\.cpp|\.h|\.mak|\.[= sS])$/) { - ERROR("do not set execute permissions for source files\n" . $permhere); - } - } - # Only allow Python 3 interpreter if ($realline =3D=3D 1 && $line =3D~ /^\+#!\ *\/usr\/bin\/(?:env )?python$/) { --=20 2.49.0 From nobody Tue Dec 16 02:14:55 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1747674734; cv=none; d=zohomail.com; s=zohoarc; b=lepCqdvLgWs8aZwB72HsyEwSDoKzCt1Pgl2Ke5LD0NPhDOR2f8B0uVJxIGeALzkXTknN13/BaCryuazn9/uY2wIdvIQgAz4SA8mtXSXJwgRF49si49Z3WIg2ko/4NOxQLsrzTOgNWbi/t7McPD5p8w/M8F7SPxnCYfwwHWXlUnM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1747674734; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=c4E8rgHsQb3gq0oCSF5CNcRbOTsrBL7NcaTAez1HiMI=; b=NiXbrsW/+hSkOhgdty4f46TKzpEH3VTAevPP4tRYBAJLCjjMv20XuLfbonPdGpCDIN7qy44zfmfiLZy3gFSfEIVjWPEDFbl4KlMidOnt014NRm+NGBEuMXaaUo4ZD2YGJU0XiIdPu8e8SqoFk6Ufd/OSKtbHh/qWi9KUFmEfVXA= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1747674734436490.43599714473726; Mon, 19 May 2025 10:12:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uH40X-0005yy-Az; Mon, 19 May 2025 13:10:33 -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 1uH40U-0005yE-5F for qemu-devel@nongnu.org; Mon, 19 May 2025 13:10:30 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uH40S-0001ZF-0J for qemu-devel@nongnu.org; Mon, 19 May 2025 13:10:29 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-633-ZwyzHGkYMzKgRRkXq5OogQ-1; Mon, 19 May 2025 13:10:23 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id E856C180035F; Mon, 19 May 2025 17:10:22 +0000 (UTC) Received: from toolbx.redhat.com (unknown [10.42.28.50]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id A0BD219560AA; Mon, 19 May 2025 17:10:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1747674627; h=from:from: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; bh=c4E8rgHsQb3gq0oCSF5CNcRbOTsrBL7NcaTAez1HiMI=; b=Jrp4ty2ULgfSLVK5+AMIsIUdAqh05mZNV2DHOZQqURuUwyaQjKRa8iz0xyNND6iCYAgCKe V8YCbJ1ZQhnp2Fn3YtOQh0/3rNaM8tsJpQxBVZzp2eHoigR4BRyoFFkgv9k6s4CwAR6fdt gdrz30yapVYsJkwA7N+Lc8FzDu4/mxc= X-MC-Unique: ZwyzHGkYMzKgRRkXq5OogQ-1 X-Mimecast-MFC-AGG-ID: ZwyzHGkYMzKgRRkXq5OogQ_1747674623 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Peter Maydell , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PATCH v5 6/9] scripts/checkpatch: expand pattern for matching makefiles Date: Mon, 19 May 2025 18:10:01 +0100 Message-ID: <20250519171004.352636-7-berrange@redhat.com> In-Reply-To: <20250519171004.352636-1-berrange@redhat.com> References: <20250519171004.352636-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=170.10.129.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.13, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=-1, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, 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 @redhat.com) X-ZM-MESSAGEID: 1747674734802116600 The current regex matches Makefile & Makefile.objs, but the latter is no longer used, anjd we're missing coverage of Makefile.include and Makefile.target. Expand the pattern to match any suffix. Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Peter Maydell Signed-off-by: Daniel P. Berrang=C3=A9 --- scripts/checkpatch.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index e208222e75..2c8e8135b6 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -1454,7 +1454,7 @@ sub process_start_of_file { my $permhere =3D $fileinfo->{linestart} . "FILE: " . $fileinfo->{filenew} . "\n"; if ($fileinfo->{filenew} =3D~ - /(\bMakefile(?:\.objs)?|\.(c|cc|cpp|h|mak|s|S))$/) { + /(\bMakefile.*|\.(c|cc|cpp|h|mak|s|S))$/) { ERROR("do not set execute permissions for source " . "files\n" . $permhere); } --=20 2.49.0 From nobody Tue Dec 16 02:14:55 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1747674729; cv=none; d=zohomail.com; s=zohoarc; b=DbhHgPXPqA6cGMhqvOUYcgm0MCJiDztjzO5GlWfEvc3n1K8hPWF3FN6l9MuajzPPV/TYwa1zWEOVvyiHsaslKVEV/Xk156gH88p7rhLNxHNaffINKX1AkflqsC9TwLQ7hCc69EhlZomVyLX5QAnzb76RX3AWebU6PUeDiGsmYFo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1747674729; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=nf8LkFWMBn9+9mPkCxsByAQm9qHcIlr5yFs/l+ijCoI=; b=dZu/RKduW5Pud2sQjNZ29RNVp+eN3jffpLi6nXqXMX2f3IAZ62i2swwnBZ8BXJdG3kxGh/0Lka1+i/rx6aDJbXZZHgchL8bTrtwt01PIKLmx4QrX7moRiNKqqmaGNyzUQRpmdq3VJyaHF80aFJwjkWMNKaI45+QlbbOfF+SC8zQ= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1747674729181278.1430347159842; Mon, 19 May 2025 10:12:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uH40X-0005zM-S1; Mon, 19 May 2025 13:10:33 -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 1uH40V-0005yf-Lx for qemu-devel@nongnu.org; Mon, 19 May 2025 13:10:31 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uH40T-0001ZS-WB for qemu-devel@nongnu.org; Mon, 19 May 2025 13:10:31 -0400 Received: from mx-prod-mc-01.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-681-3ku240DSNs2QGU-lOAB3ww-1; Mon, 19 May 2025 13:10:25 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id EEB2E195608C; Mon, 19 May 2025 17:10:24 +0000 (UTC) Received: from toolbx.redhat.com (unknown [10.42.28.50]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 4AD6A19560AA; Mon, 19 May 2025 17:10:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1747674629; h=from:from: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; bh=nf8LkFWMBn9+9mPkCxsByAQm9qHcIlr5yFs/l+ijCoI=; b=aTNTAO9cMVzikVaB4VZmwlSqaTHnOrOnKTNDHv0AKu6+CBSvWRuAiJnrB7pSxdG3gI8veC BH21gGYSD9J7BpOhav8R1bOkd22RYNQlSirwIrM333uyyGmYfX+ENlZ/gVKhBt7XZgoUqy uh/5HPh617cl3TBoTXt0oowH+AqZ9Ko= X-MC-Unique: 3ku240DSNs2QGU-lOAB3ww-1 X-Mimecast-MFC-AGG-ID: 3ku240DSNs2QGU-lOAB3ww_1747674625 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Peter Maydell , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PATCH v5 7/9] scripts/checkpatch: use new hook for MAINTAINERS update check Date: Mon, 19 May 2025 18:10:02 +0100 Message-ID: <20250519171004.352636-8-berrange@redhat.com> In-Reply-To: <20250519171004.352636-1-berrange@redhat.com> References: <20250519171004.352636-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=170.10.129.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.13, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=-1, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, 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 @redhat.com) X-ZM-MESSAGEID: 1747674730785116600 When seeing a new/deleted/renamed file we check to see if MAINTAINERS is updated, but we don't give the user a list of files affected, as we don't want to repeat the same warning many times over. Using the new file list hook, we can give a single warning at the end with a list of filenames included. Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Peter Maydell Signed-off-by: Daniel P. Berrang=C3=A9 --- scripts/checkpatch.pl | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 2c8e8135b6..de6ea2fc14 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -1443,6 +1443,25 @@ sub process_file_list { join("\n ", @acpi_nontestexpected) . "\n\nfound in the same patch\n"); } + + my $sawmaintainers =3D 0; + my @maybemaintainers; + foreach my $fileinfo (@fileinfos) { + if ($fileinfo->{action} ne "modified" && + $fileinfo->{filenew} !~ m#^tests/data/acpi/#) { + push @maybemaintainers, $fileinfo->{filenew}; + } + if ($fileinfo->{filenew} eq "MAINTAINERS") { + $sawmaintainers =3D 1; + } + } + + # If we don't see a MAINTAINERS update, prod the user to check + if (int(@maybemaintainers) > 0 && !$sawmaintainers) { + WARN("added, moved or deleted file(s):\n\n " . + join("\n ", @maybemaintainers) . + "\n\nDoes MAINTAINERS need updating?\n"); + } } =20 # Called at the start of processing a diff hunk for a file @@ -1486,7 +1505,6 @@ sub process { =20 my $in_header_lines =3D $file ? 0 : 1; my $in_commit_log =3D 0; #Scanning lines before patch - my $reported_maintainer_file =3D 0; my $reported_mixing_imported_file =3D 0; my $in_imported_file =3D 0; my $in_no_imported_file =3D 0; @@ -1761,23 +1779,6 @@ sub process { } } =20 -# Check if MAINTAINERS is being updated. If so, there's probably no need = to -# emit the "does MAINTAINERS need updating?" message on file add/move/dele= te - if ($line =3D~ /^\s*MAINTAINERS\s*\|/) { - $reported_maintainer_file =3D 1; - } - -# Check for added, moved or deleted files - if (!$reported_maintainer_file && !$in_commit_log && - ($line =3D~ /^(?:new|deleted) file mode\s*\d+\s*$/ || - $line =3D~ /^rename (?:from|to) [\w\/\.\-]+\s*$/ || - ($line =3D~ /\{\s*([\w\/\.\-]*)\s*\=3D\>\s*([\w\/\.\-]*)\s*\}/ && - (defined($1) || defined($2)))) && - $realfile !~ m#^tests/data/acpi/#) { - $reported_maintainer_file =3D 1; - WARN("added, moved or deleted file(s), does MAINTAINERS need updating?\= n" . $herecurr); - } - # Check SPDX-License-Identifier references a permitted license if ($rawline =3D~ m,SPDX-License-Identifier: (.*?)(\*/)?\s*$,) { &checkspdx($realfile, $1); --=20 2.49.0 From nobody Tue Dec 16 02:14:55 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1747674725; cv=none; d=zohomail.com; s=zohoarc; b=ZwWkIGqVyRQLSVfMzcI9WC9bSe0lMkBd7m0tCoon1oBlO3j877vYQM1yXNewn+2rRa/rIWGL/VYHBVFF/Q91C/S/RyoP9C+WU9NERozk4Sy19F6wIPHM9NcOZ26sdYPy1fQoCOJi9gE0YdWM7r15CPWg/8TZJ8F0z//X87AymJE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1747674725; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=PIUaRKuYcvrrpm/JrbDy5K1w1botK8DhkqScYbEn/0g=; b=alVkRI+hI9OTuFRWfwJAVmToJkOwcljQTKe/HNbbb5Jip06OP7FwiGQqXTVs47E/Qsp+beERaYfavp9G7mbF+UJ9pL3VCRnGB5Z9KRS1NHIxW8/8pBouJkOg+f6zAZtIBifFwBF4nBTdhdRTQc0LuOoEnltDAw+ffj/NSWR/Vfs= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 174767472532686.50489253393823; Mon, 19 May 2025 10:12:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uH40a-0005zo-Bz; Mon, 19 May 2025 13:10:36 -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 1uH40Y-0005zO-AW for qemu-devel@nongnu.org; Mon, 19 May 2025 13:10:34 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uH40W-0001Zi-9X for qemu-devel@nongnu.org; Mon, 19 May 2025 13:10:34 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-497-mFj-0f5YPS63iuAl8U97GA-1; Mon, 19 May 2025 13:10:28 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 34582180034A; Mon, 19 May 2025 17:10:27 +0000 (UTC) Received: from toolbx.redhat.com (unknown [10.42.28.50]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 69ADA19560AA; Mon, 19 May 2025 17:10:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1747674631; h=from:from: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; bh=PIUaRKuYcvrrpm/JrbDy5K1w1botK8DhkqScYbEn/0g=; b=bLSkAsp5WcPYboSIStTCvmgzPXFrrBDoYMLOF9Hjn0sTRRYlxjyWyjmOs0aOKFACZaAe88 OG4MKbKq8vxuaMFVV2+vijmh2rErgqnc9DtEKS43t9oAIaSYn2jWmky0Gl4Jmho9M6KWgn nmhAdKysp3O5eUq9W1at9lh6SwBF5aE= X-MC-Unique: mFj-0f5YPS63iuAl8U97GA-1 X-Mimecast-MFC-AGG-ID: mFj-0f5YPS63iuAl8U97GA_1747674627 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Peter Maydell , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PATCH v5 8/9] scripts/checkpatch: reimplement mandate for SPDX-License-Identifier Date: Mon, 19 May 2025 18:10:03 +0100 Message-ID: <20250519171004.352636-9-berrange@redhat.com> In-Reply-To: <20250519171004.352636-1-berrange@redhat.com> References: <20250519171004.352636-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=170.10.129.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.13, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=-1, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, 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 @redhat.com) X-ZM-MESSAGEID: 1747674726721116600 Going forward we want all newly created source files to have an SPDX-License-Identifier tag present. Initially mandate this for C, Python, Perl, Shell source files, as well as JSON (QAPI) and Makefiles, while encouraging users to consider it for other file types. The new attempt at detecting missing SPDX-License-Identifier relies on the hooks for relying triggering logic at the end of scanning a new file in the diff. Tested-by: C=C3=A9dric Le Goater Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Peter Maydell Signed-off-by: Daniel P. Berrang=C3=A9 --- scripts/checkpatch.pl | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index de6ea2fc14..dc2c3e6aa1 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -1483,6 +1483,20 @@ sub process_start_of_file { # Called at the end of processing a diff hunk for a file sub process_end_of_file { my $fileinfo =3D shift; + + if ($fileinfo->{action} eq "new" && + !exists $fileinfo->{facts}->{sawspdx}) { + if ($fileinfo->{filenew} =3D~ + /(\.(c|h|py|pl|sh|json|inc)|Makefile.*)$/) { + # source code files MUST have SPDX license declared + ERROR("New file '" . $fileinfo->{filenew} . + "' requires 'SPDX-License-Identifier'"); + } else { + # Other files MAY have SPDX license if appropriate + WARN("Does new file '" . $fileinfo->{filenew} . + "' need 'SPDX-License-Identifier'?"); + } + } } =20 sub process { @@ -1781,6 +1795,7 @@ sub process { =20 # Check SPDX-License-Identifier references a permitted license if ($rawline =3D~ m,SPDX-License-Identifier: (.*?)(\*/)?\s*$,) { + $fileinfo->{facts}->{sawspdx} =3D 1; &checkspdx($realfile, $1); } =20 --=20 2.49.0 From nobody Tue Dec 16 02:14:55 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1747674667; cv=none; d=zohomail.com; s=zohoarc; b=O4Unj3u7eQL9zu5I7x6uR1chp+BrT/DR3ukDGR8aa4jwMZhvziOY/NCK3cWYjz6OfDNJD9gNm9BvTWFc7zUa0dWidh+P83DuUs+DAzvhQskpzGydQvH2D7dG8GUiFICn0496zDzwb8E/xmufuedALUdnTctrZTd0mwsRV8g/Asw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1747674667; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=bHxr2avKZwMQbb4Nt5uTm7UKAaDRZw9/aTaWTEK5ZtI=; b=bNu0tw0Xf/Vecml7MdGIzobUTaaA0uD6gLLpLERKYq77gO14jYH28T4eUEhXlvSwiEPlPMZzyewTR1VWaw8thwLcN1+n8RQfXVd2cWq9DXPn1N6TK5Lbn/R1Ccco0ZU/HybELghLJwIqUB60BvGPeqhzohk0cRnooRFyuWeo1nc= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1747674667628923.251614428049; Mon, 19 May 2025 10:11:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uH40d-00060q-GN; Mon, 19 May 2025 13:10:39 -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 1uH40b-0005zp-04 for qemu-devel@nongnu.org; Mon, 19 May 2025 13:10:37 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uH40Z-0001Zz-8t for qemu-devel@nongnu.org; Mon, 19 May 2025 13:10:36 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-600-6xq7pAJwPZicjOjCx8xOvg-1; Mon, 19 May 2025 13:10:31 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8DC0E1800368; Mon, 19 May 2025 17:10:29 +0000 (UTC) Received: from toolbx.redhat.com (unknown [10.42.28.50]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id ABA0D19560AA; Mon, 19 May 2025 17:10:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1747674634; h=from:from: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; bh=bHxr2avKZwMQbb4Nt5uTm7UKAaDRZw9/aTaWTEK5ZtI=; b=ON1Ze26T9LkFU6cB01I9ympb0TIQwAIap6RVr9/1gOqsLHTFQpBOEdnINTIQCH32gQu0sM jyYzCgmq/z2BMkUDJlQdBy8T8AW/zfEaUk2Peo1FxAOPK7Zx1fhMOK7p+jOepAKktVc+Uc QfDC71+LQOiWFs1tw+ER55ZNgekuebc= X-MC-Unique: 6xq7pAJwPZicjOjCx8xOvg-1 X-Mimecast-MFC-AGG-ID: 6xq7pAJwPZicjOjCx8xOvg_1747674629 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Peter Maydell , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH v5 9/9] scripts/checkpatch: reject license boilerplate on new files Date: Mon, 19 May 2025 18:10:04 +0100 Message-ID: <20250519171004.352636-10-berrange@redhat.com> In-Reply-To: <20250519171004.352636-1-berrange@redhat.com> References: <20250519171004.352636-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=170.10.133.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.13, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=-1, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, 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 @redhat.com) X-ZM-MESSAGEID: 1747674675415116600 The previous commit mandates use of SPDX-License-Identifier on common source files, and encourages it on all other files. Some contributors are none the less still also including the license boilerplate text. This is redundant and will potentially cause trouble if inconsistent with the SPDX declaration. Match common boilerplate text blurbs and report them as invalid, for newly added files. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Peter Maydell --- scripts/checkpatch.pl | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index dc2c3e6aa1..17b8db40ad 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -365,6 +365,18 @@ our @typeList =3D ( qr{guintptr}, ); =20 +# Match text found in common license boilerplate comments: +# for new files the SPDX-License-Identifier line is sufficient. +our @LICENSE_BOILERPLATE =3D ( + "licensed under the terms of the GNU GPL", + "under the terms of the GNU General Public License", + "under the terms of the GNU Lesser General Public", + "Permission is hereby granted, free of charge", + "GNU GPL, version 2 or later", + "See the COPYING file" +); +our $LICENSE_BOILERPLATE_RE =3D join("|", @LICENSE_BOILERPLATE); + # Load common spelling mistakes and build regular expression list. my $misspellings; my %spelling_fix; @@ -1497,6 +1509,13 @@ sub process_end_of_file { "' need 'SPDX-License-Identifier'?"); } } + if ($fileinfo->{action} eq "new" && + exists $fileinfo->{facts}->{sawboilerplate}) { + ERROR("New file '" . $fileinfo->{filenew} . "' must " . + "not have license boilerplate header text, only " . + "the SPDX-License-Identifier, unless this file was " . + "copied from existing code already having such text."); + } } =20 sub process { @@ -1799,6 +1818,10 @@ sub process { &checkspdx($realfile, $1); } =20 + if ($rawline =3D~ /$LICENSE_BOILERPLATE_RE/) { + $fileinfo->{facts}->{sawboilerplate} =3D 1; + } + if ($rawline =3D~ m,(SPDX-[a-zA-Z0-9-_]+):,) { my $tag =3D $1; my @permitted =3D qw( --=20 2.49.0 From nobody Tue Dec 16 02:14:55 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1747818403; cv=none; d=zohomail.com; s=zohoarc; b=NIvt39+CYkz08WjCHNzrTCDZ6e4HPs8/uY2f+hTIO1Oi/da/ejMLtGDhipp+treACUd8r0M6M22KH89v2Tl6rCM8JMa3aXVm8UjCDmONWqtHcsZ4XRH/6tArC+F839r8CGZkaVR4k00VbJNJ81B5m+60qyWfLmlI/mmvc21FNaA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1747818403; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id:Cc; bh=mbntxoFO+HxR+TpSoBYNhdO4fjkx/ZcxvgLgffvhmU4=; b=AhZarCj44BtKwKk4KEbU7mcW/Dg/Z3pXbj8q5jL4RwXCrxlwib15DQigOOgcA7Cx3DLSl/c9+SbqsneCU0T7QGlAMuZi+4JWa2loLuOXUE/Uit5OYNtmz1OoANNQS5/anqFEJtqVxDnFuSz7m4LVPLWGEzpkR0PBQePSB+0nonI= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1747818403066343.9465402058961; Wed, 21 May 2025 02:06:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uHfOW-00074i-2P; Wed, 21 May 2025 05:05:48 -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 1uHfOV-00074T-3v for qemu-devel@nongnu.org; Wed, 21 May 2025 05:05:47 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uHfOT-0005xw-6s for qemu-devel@nongnu.org; Wed, 21 May 2025 05:05:46 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-558-ImN-lEKHNvi57SHiuuN14w-1; Wed, 21 May 2025 05:05:41 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C3CCF1800370 for ; Wed, 21 May 2025 09:05:40 +0000 (UTC) Received: from redhat.com (unknown [10.42.28.129]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C470019560AD for ; Wed, 21 May 2025 09:05:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1747818343; h=from:from:reply-to: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; bh=mbntxoFO+HxR+TpSoBYNhdO4fjkx/ZcxvgLgffvhmU4=; b=DU/lCVuGOqYHbX2GARlKqEvcti7TmV77LUZQytUAhW5S9Jk1Ng2R6Nyr0sT3w9X5Xff7Au BCOUzqwfCNH7i+bjBJqxCrT0EhWqNH5N+alJbVayUmZDkCe489I24sAMarmWcqU54tTKzl Pzyiyp+mPRQdOCJQROgbExqsyjIS21w= X-MC-Unique: ImN-lEKHNvi57SHiuuN14w-1 X-Mimecast-MFC-AGG-ID: ImN-lEKHNvi57SHiuuN14w_1747818341 Date: Wed, 21 May 2025 10:05:35 +0100 From: Daniel =?utf-8?B?UC4gQmVycmFuZ8Op?= To: qemu-devel@nongnu.org Subject: [PATCH v5 10/9] scripts/checkpatch.pl: mandate SPDX tag for Rust src files Message-ID: References: <20250519171004.352636-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <20250519171004.352636-1-berrange@redhat.com> User-Agent: Mutt/2.2.14 (2025-02-20) X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=170.10.133.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.487, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, 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: , Reply-To: Daniel =?utf-8?B?UC4gQmVycmFuZ8Op?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1747818405052116600 Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Manos Pitsidianakis --- scripts/checkpatch.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 17b8db40ad..c0b36a85cd 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -1499,7 +1499,7 @@ sub process_end_of_file { if ($fileinfo->{action} eq "new" && !exists $fileinfo->{facts}->{sawspdx}) { if ($fileinfo->{filenew} =3D~ - /(\.(c|h|py|pl|sh|json|inc)|Makefile.*)$/) { + /(\.(c|h|py|pl|sh|json|inc|rs)|Makefile.*)$/) { # source code files MUST have SPDX license declared ERROR("New file '" . $fileinfo->{filenew} . "' requires 'SPDX-License-Identifier'"); --=20 2.49.0