From nobody Tue Nov 26 08:53:42 2024 Received: from mail-qk1-f174.google.com (mail-qk1-f174.google.com [209.85.222.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 285C714D71E for ; Sat, 19 Oct 2024 16:25:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729355139; cv=none; b=OwipbKB7o9UtInh1n2yr1sy6eqJ1nYAQEhzA+MeuV7W7lzmuaTBfm6VndMDYHqp2a8pLr9FahrESfpuXvlHR1+lEMPFDvU1gao0tNwiLDWVq+FRXsLl+irFpL62Si0rmFsE1Q9TKcJJnezJ5ItIHQrNpYEwvjulW8ZB80vTpqC8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729355139; c=relaxed/simple; bh=WFVJXGOzIlA+UAKGT/1uhhUCCEbVrPsnTLT32DDjddI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=MSB4DP/PnGE/sAFiAjdvnOmNY9+oGUzIog5LU5vpsBMlZV3ULQ7J3ca3iYEOGM86DFjg1GGXkyki8f/xXIlFMb+Xt1WRfreB3p6IdQUTsg+QLFJkUdEUtvgTk0I1MyVVKTxZoPxghL079eL79RzRPK3xwtBjXEG/Kf3+W2UtZPM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=biYag8V6; arc=none smtp.client-ip=209.85.222.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="biYag8V6" Received: by mail-qk1-f174.google.com with SMTP id af79cd13be357-7b1434b00a2so253928985a.0 for ; Sat, 19 Oct 2024 09:25:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729355136; x=1729959936; darn=vger.kernel.org; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:from:to:cc:subject:date:message-id:reply-to; bh=ZAYuuz8UyB/972vIhSKwabgRr+7o7vjOna67Xechz4I=; b=biYag8V6iMZdCVtxbJntZH0Tx98tvoaJKw+fKkZ0xDmYTXgvUhLzUaN5pITSqpchay KfGpG/KTeJ/kgortw/Uaw0T6XOYMzA8Mao0rjtzhYwwctVuXQxD5KtDzBRxwKS6qQSyI EGFgLh8JkkCP2NbzcUn8mj1DPuiRLwRE9TaGmD+KMEOMD+IiNRDIuBT4BKbK9EUUgRZv sNxd6nytz9MEadaloGoOFUfrb04t5FVDqjPV//2DTUk+MhSYbxuFR9+SOZrwW4q1pbQv UOJU6/e9yd3JorjEKKdLDtJXuQd1lSOxjcUCjEchoPuIJNxKlHyNXuD3Om7fB9+T1njA GdeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729355136; x=1729959936; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ZAYuuz8UyB/972vIhSKwabgRr+7o7vjOna67Xechz4I=; b=f2sagcDlcLAstYIYHBP+QalqKSQfL0vCy2UYGD+JtieYjqzjIv0R9ACHKiJ4XaK6mC mdMdbp5uYZvb02aCIatxoU51pdnOKwFGbftduCRljR5637hO28ykkHsqXHEssFoygmOu UcdLMQt3hhfr3Sdr2465s9B93IBjoSIvdIG5I0jVLAyvVmSdpJk79M/RQfd9q8ArN4zG /M7M9gSOcvMGQABLMoKKzR/iCKovelDBK41DikOWfJ27b+OK6jBjdM4Q5hB9Qkneo/yu EThllYIkGXwdM/gRiAb+28c5vujmeGYIeZJ0ft6OMPAAzuTcDZMSIlwix+5fFvJLCoOE jgkg== X-Forwarded-Encrypted: i=1; AJvYcCXkKoBSWmhY32jmPyYBteUWixCQ9Q1J42im04ANfWY0mxDhcMzEK2HPuDZhen+z3q83uAjfDakJge/07lM=@vger.kernel.org X-Gm-Message-State: AOJu0Yylm1wHMC4FGMBr0nXs2VjLHSWdpA2zNbE0JsGfkeIkhZyXxS2m J27p3gABtxnPi/JL6XA2KB2irrIKbEihTeGTM1UKcGyAMjQRJ99FWo0NsU7qyLYAEQ== X-Google-Smtp-Source: AGHT+IEeRsHfu9S63tUkW2D1GA9dVjrATQOss2Mu/T3TSpQZfI+s76uJtjXamgcNY5LAPETwVVhLPw== X-Received: by 2002:a05:620a:4407:b0:7b1:49d3:29c7 with SMTP id af79cd13be357-7b157b40f3cmr848398285a.2.1729355135867; Sat, 19 Oct 2024 09:25:35 -0700 (PDT) Received: from 156.1.168.192.in-addr.arpa (pool-100-37-170-231.nycmny.fios.verizon.net. [100.37.170.231]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7b156f8a942sm195692085a.18.2024.10.19.09.25.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Oct 2024 09:25:34 -0700 (PDT) From: Tamir Duberstein Date: Sat, 19 Oct 2024 12:25:29 -0400 Subject: [PATCH] checkpatch: always parse orig_commit in fixes tag Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241019-checkpatch-fixes-commit-v1-1-0d0cde18ce69@gmail.com> X-B4-Tracking: v=1; b=H4sIAHjdE2cC/x3LQQqAIBBA0avErBvQkqCuEi1snHKINDQiiO6et Hx8/gOZk3CGoXog8SVZYijQdQXkbVgZxRVDoxqjle6RPNN22JM8LnJzRor7Lidaq7RZuHNqbqH cR+K/l3mc3vcDew7bOmkAAAA= X-Change-ID: 20241019-checkpatch-fixes-commit-aa014fe6d0b3 To: Andy Whitcroft , Joe Perches , Dwaipayan Ray , Lukas Bulwahn , Simon Horman , =?utf-8?q?Niklas_S=C3=B6derlund?= , Andrew Morton Cc: Louis Peens , linux-kernel@vger.kernel.org, Tamir Duberstein X-Mailer: b4 0.15-dev Do not require the presence of `$balanced_parens` to get the commit SHA; this allows a `Fixes: deadbeef` tag to get a correct suggestion rather than a suggestion containing a reference to HEAD. Ironically this: Fixes: bd17e036b495 ("checkpatch: warn for non-standard fixes tag style") Signed-off-by: Tamir Duberstein --- scripts/checkpatch.pl | 37 ++++++++++++++++--------------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 4427572b24771ddb1f2bf3de3176f9437f643951..b03d526e4c454af7a4262415517= 5e109d499762f 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -3209,36 +3209,31 @@ sub process { =20 # Check Fixes: styles is correct if (!$in_header_lines && - $line =3D~ /^\s*fixes:?\s*(?:commit\s*)?[0-9a-f]{5,}\b/i) { - my $orig_commit =3D ""; - my $id =3D "0123456789ab"; - my $title =3D "commit title"; - my $tag_case =3D 1; - my $tag_space =3D 1; - my $id_length =3D 1; - my $id_case =3D 1; + $line =3D~ /^\s*(fixes:?)\s*(?:commit\s*)?([0-9a-f]{5,40})(?:\s*($ba= lanced_parens))?/i) { + my $tag =3D $1; + my $orig_commit =3D $2; + my $title; my $title_has_quotes =3D 0; $fixes_tag =3D 1; - - if ($line =3D~ /(\s*fixes:?)\s+([0-9a-f]{5,})\s+($balanced_parens)/i) { - my $tag =3D $1; - $orig_commit =3D $2; - $title =3D $3; - - $tag_case =3D 0 if $tag eq "Fixes:"; - $tag_space =3D 0 if ($line =3D~ /^fixes:? [0-9a-f]{5,} ($balanced_pare= ns)/i); - - $id_length =3D 0 if ($orig_commit =3D~ /^[0-9a-f]{12}$/i); - $id_case =3D 0 if ($orig_commit !~ /[A-F]/); - + if (defined $3) { # Always strip leading/trailing parens then double quotes if existing - $title =3D substr($title, 1, -1); + $title =3D substr($3, 1, -1); if ($title =3D~ /^".*"$/) { $title =3D substr($title, 1, -1); $title_has_quotes =3D 1; } + } else { + $title =3D "commit title" } =20 + + my $tag_case =3D not ($tag eq "Fixes:"); + my $tag_space =3D not ($line =3D~ /^fixes:? [0-9a-f]{5,40} ($balanced_p= arens)/i); + + my $id_length =3D not ($orig_commit =3D~ /^[0-9a-f]{12}$/i); + my $id_case =3D not ($orig_commit !~ /[A-F]/); + + my $id =3D "0123456789ab"; my ($cid, $ctitle) =3D git_commit_info($orig_commit, $id, $title); =20 --- base-commit: 3d5ad2d4eca337e80f38df77de89614aa5aaceb9 change-id: 20241019-checkpatch-fixes-commit-aa014fe6d0b3 Best regards, --=20 Tamir Duberstein