From nobody Mon Nov 25 14:34:07 2024 Received: from mail-qk1-f172.google.com (mail-qk1-f172.google.com [209.85.222.172]) (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 0DBCE21746D for ; Fri, 25 Oct 2024 20:49:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729889380; cv=none; b=X7r5U2T0KNMh/X+8If0kxhaCwIl9x8vWbvYV8J2+ZzrV4l1aKE5Sb2IFzisC2bM5WwV6FCyaEqiX4CfYJBa7qwAz/nWyktqFfMT+jm/8K436Ct+myCfWac6zVWandp9vAx2F5qmMomHr/g3ABV+PJOHaLjJghwU/faIBxGgMPxc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729889380; c=relaxed/simple; bh=LEFNEBRsF3wSEaFE8p7mGPUOPvhHFlmdgo14J6EAyJ4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=Ye6mDBZKWdFMN9a3GKlnyN3q3QV5lX5jPB4QOn7dW0IziZotjG/8tn9uc7oJyQUe9d/oMPIAUmGU10CDsD7117q5q46KZpbgkj9gqn2M4sgNgkqy6K9UgVbbV8L2rH6Pui79o1UaX8DHdvzu6LUHcNheAlkfBKbX4R5bY6HMGDE= 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=Ikr7ItYi; arc=none smtp.client-ip=209.85.222.172 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="Ikr7ItYi" Received: by mail-qk1-f172.google.com with SMTP id af79cd13be357-7b14077ec5aso325892185a.1 for ; Fri, 25 Oct 2024 13:49:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729889377; x=1730494177; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=HaNSsC4KUZ64ui98jp8meP1eBKQiBOs+wvC+63/8s/o=; b=Ikr7ItYiU1w8/xUdoib+SX1PbYqORmyT+z/n6szJ3ZA3ngO1tE0ALjAtFrLGzC6ldF zw8pyssjhn9MPX4SpF9SWR71tPHSeK5ldAQnhNFF/Gz1e4fypnKZWnIL9lcYXPXRAC6X GKxNhhCkSpXM00gVAMMkycZ0w2Bet9XbKrhp27zFG1Ew5bZ7eKv5S3e6txFkvDNDouf7 QRm6V4CWDX9rjpFSOx7kCH0atjPWAq5McrEiQZjmPA8nPM/BQ5GUcY4HNorUKkDZ1gfu 64FgAwy2Cl6LJDivar1349gRiOJ4wiR53dJmvQIOQG8sbqhhXWmv6r/T+qwQY0BLCzy0 Je9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729889377; x=1730494177; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=HaNSsC4KUZ64ui98jp8meP1eBKQiBOs+wvC+63/8s/o=; b=ITdIK0UryEzWUetHwRXe7uxofiLGjtAJNEe3Tz18o++dNAE2UlBHBAGBbTdqhu+80k Zcl//dAIhkvt9HK14nK2ftwfImMeAivM+6peduFvJg7EHEdH4/sGMPdLv7vJcNwUpl3i SFqoTUYdz3M8w9czpbzN4xM65hpIP6NVA7ACS98lieIKYc5DnGTsZzdM+ui6HWGsekV7 lle4GvVUZRtvyMP1Xaogj/0NhHYRQtOHN3XCO8NXHGV8iuZS6w1G1rnie3Z2aZoMcNsD H8d/v979AhrdOQZjenUnvMw6hFNXxE0OZ/b8TRnT4viNJGg4hpAMbQCSCb1TLy+T0fm9 z6ow== X-Forwarded-Encrypted: i=1; AJvYcCWPL9hHV5brQLwyex2Hmv3u1G4tvZ2KQ6eBXlwwlIGkC1rWzZ0AeyzowlvikuZY8rmCANd252EDmXBAh1E=@vger.kernel.org X-Gm-Message-State: AOJu0YzT1ARYuESsxYXx9tvZEVsTEfe5wzLOeXEbsnHP378bFthZhNVj WAq4ryOXNxYleV0YUB7tBGr5pbfSz1O4odYbqT4RfklRRADltfaB X-Google-Smtp-Source: AGHT+IFM+LN7/ckayj5f9Xw8CmTrs6jwfmfLYNRPJhoYJpT4r0Lsys1hHg6zlDyaz1K3O9N0cxcUyg== X-Received: by 2002:a05:620a:1a1d:b0:7ab:3516:56c1 with SMTP id af79cd13be357-7b1865d36f6mr1307891085a.14.1729889376780; Fri, 25 Oct 2024 13:49:36 -0700 (PDT) Received: from Tamirs-MBP.mynetworksettings.com (pool-100-37-170-231.nycmny.fios.verizon.net. [100.37.170.231]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-461323abd6csm9393431cf.94.2024.10.25.13.49.34 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 25 Oct 2024 13:49:35 -0700 (PDT) From: Tamir Duberstein To: Andy Whitcroft , Joe Perches , Dwaipayan Ray , Lukas Bulwahn , Simon Horman , =?utf-8?q?Niklas_S=C3=B6derlund?= , Andrew Morton Cc: Tamir Duberstein , Louis Peens , linux-kernel@vger.kernel.org Subject: [PATCH RESEND] checkpatch: always parse orig_commit in fixes tag Date: Fri, 25 Oct 2024 16:48:34 -0400 Message-ID: <20241025-checkpatch-fixes-commit-v1-1-1b31f9ce178b@gmail.com> X-Mailer: git-send-email 2.47.0 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" X-Mailer: b4 0.15-dev Content-Transfer-Encoding: quoted-printable 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, -----BEGIN SSH SIGNATURE----- U1NIU0lHAAAAAQAAADMAAAALc3NoLWVkMjU1MTkAAAAgtYz36g7iDMSkY5K7Ab51ksGX7h JgsMRt+XVZTrIzMVIAAAADZ2l0AAAAAAAAAAZzaGE1MTIAAABTAAAAC3NzaC1lZDI1NTE5 AAAAQEhO1Vh/OvD8e3HTwEvNpWeLJl11NLWPF00vpbfhJuWh5YZw0c1Zet+JadYOa+a6By vg8Vjtx86wc+UjDmAJbAs=3D -----END SSH SIGNATURE----- --=20 Tamir Duberstein