From nobody Sun Sep 27 00:40:31 2026 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=1785168769; cv=none; d=zohomail.com; s=zohoarc; b=HDQ3fu9gw+8IHMTSyFw5WpO+IV0sQP+G2R/yRaYfkhnpEibNGyLxmC3tWa3p2Ap4o5ZzrErQhMMviFU3elgSALrYDkUImTYzQiqroGWVKogWMAhe6vNNTj5PbRyYkA+LaQtzapaaWcfqjQ4TjslHAH8GDF3HGtzaVZqy5YRFVWs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785168769; h=Content-Type: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=VyriG6r8kFXeFEsuHn9qWyV7x8BT/tGnBpBLeDt657g=; b=CAZPGPxIFO8g3dOMjtEBA5apR1+fqXf5rzKMvl/RE4MdV70bwkFYip105PVK9kh4P0uUyRbWQRJ09kGoQfRLjjCNxXp2qA4IppJUjFbL6ONg7EpOPUqY+6w/cEgWIbCZAzam+zu25zIGrxiiCgtIrC68/B1Ci+35gPgt5NYdyOM= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 178516876899286.27157498810686; Mon, 27 Jul 2026 09:12:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1woNwB-0007a1-18; Mon, 27 Jul 2026 12:12:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1woNw0-0007Z2-OU for qemu-devel@nongnu.org; Mon, 27 Jul 2026 12:12:10 -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 1woNvz-00005A-8P for qemu-devel@nongnu.org; Mon, 27 Jul 2026 12:12:08 -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-456-X67iZ2ydPO-LjxzLJdg0VA-1; Mon, 27 Jul 2026 12:12:04 -0400 Received: from mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.95]) (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 E1819195609E; Mon, 27 Jul 2026 16:12:02 +0000 (UTC) Received: from localhost (unknown [10.44.24.5]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 95A5A430; Mon, 27 Jul 2026 16:12:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1785168725; 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; bh=VyriG6r8kFXeFEsuHn9qWyV7x8BT/tGnBpBLeDt657g=; b=ihbWRORNKrXJeZ0kntOwn7PECSRRwCh41IOQjKzevNmIxZ1AhId5FP66dNFHKRkljJJo1e GVvWxEhYY3c9Z2NhCErzXvvhsti9cVVmHMv0xSP64r0McAJ2EROCIEu7a9MaBWLQO0Wr6G DKAS8n1LYB77VVFV4jIAB/b6Z/kKdaU= X-MC-Unique: X67iZ2ydPO-LjxzLJdg0VA-1 X-Mimecast-MFC-AGG-ID: X67iZ2ydPO-LjxzLJdg0VA_1785168723 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: mst@redhat.com, chao.liu@processmission.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH] scripts/checkpatch: warn on duplicate trailers and self-review Date: Mon, 27 Jul 2026 20:11:56 +0400 Message-ID: <20260727161157.2112984-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.6 on 10.30.177.95 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -2 X-Spam_score: -0.3 X-Spam_bar: / X-Spam_report: (-0.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.58, 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_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development 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: 1785168770950158500 From: Marc-Andr=C3=A9 Lureau Detect two common trailer mistakes: - Duplicate trailers: any trailer (Signed-off-by, Fixes, Resolves, Cc, etc.) appearing more than once with the same value in a commit message. - Self-review: a Reviewed-by, Tested-by, or Acked-by tag from the same person as the patch author, which provides no independent review value. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- scripts/checkpatch.pl | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 03f35e75012c..a9326297d626 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -1539,6 +1539,8 @@ sub process { =20 our $clean =3D 1; my $signoff =3D 0; + my $author_email =3D ''; + my %commit_trailers =3D (); my $is_patch =3D 0; =20 my $in_header_lines =3D $file ? 0 : 1; @@ -1795,6 +1797,14 @@ sub process { ERROR("Author email address is mangled by the mailing list\n" . $her= ecurr); } =20 +# Extract author email for trailer checks + if ($in_header_lines && $line =3D~ /^(?:Author|From):\s*(.*)/) { + my $author_info =3D $1; + if ($author_info =3D~ /<([^>]+)>/) { + $author_email =3D $1; + } + } + #check the patch for a signoff: if ($line =3D~ /^\s*signed-off-by:/i) { # This is a signoff, if ugly, so do not double report. @@ -1811,6 +1821,28 @@ sub process { } } =20 +# Check for duplicate trailers and self-review + if (!$in_header_lines && + $line =3D~ /^\s*([A-Z][a-zA-Z]*(?:-[a-zA-Z]+)*):\s*(.+)/) { + my $trailer_type =3D $1; + my $trailer_value =3D $2; + $trailer_value =3D~ s/\s+$//; + my $trailer_key =3D lc("$trailer_type: $trailer_value"); + + if (exists $commit_trailers{$trailer_key}) { + WARN("Duplicate '$trailer_type' trailer\n" . + $herecurr); + } + $commit_trailers{$trailer_key} =3D 1; + + if ($trailer_type =3D~ /^(?:Reviewed|Tested|Acked)-by$/ && + $author_email ne '' && + $trailer_value =3D~ /<\Q$author_email\E>/i) { + WARN("$trailer_type from the patch author\n" . + $herecurr); + } + } + # Check SPDX-License-Identifier references a permitted license if (($rawline =3D~ m,SPDX-License-Identifier: (.*?)(\*/)?\s*$,) && $rawline !~ /^-/) { --=20 2.55.0