From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4CD99C04E69 for ; Tue, 25 Jul 2023 15:59:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232326AbjGYP7i (ORCPT ); Tue, 25 Jul 2023 11:59:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231253AbjGYP7h (ORCPT ); Tue, 25 Jul 2023 11:59:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2586F210A for ; Tue, 25 Jul 2023 08:59:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B8331617D4 for ; Tue, 25 Jul 2023 15:59:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD016C433C8; Tue, 25 Jul 2023 15:59:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690300775; bh=nTTuihyI1xY7bppjNH5+k7uZ2Bsp3knPwVCY54xVBVc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bIXzsXIMqVjwdyyLRqhNfsHtiZmGus75WVrpYPtyJ8bAJjGbs/gHFG6mKO9D62kPj C6PQKrxMYnPNmxKJz9vF95HZlI0QuBf0FCDDuLKW+D3Ba4pCAYryIGCUr6NNZ6y5aB ROXCTjn+PB41uoWyDKDQwKUnMbNQlAyEl33EezoolwnFy2ZUrzSXD/cr6aOuhxu0Jk 5GUwBMJ3v2USYS/uRdGIfnmHF1KnnQpg+mi1ZbP/8CVYExPu0nRMtMUfQxtxWLbNCb ttkXnMKG2I6LIPzTG6Tk8EjWi7ZTuark1OLMiqdjW4sZDRLeGrDvMiFUfkIQPVxJWg n9IGtLxJfwAJg== From: Jakub Kicinski To: krzk@kernel.org Cc: Jakub Kicinski , joe@perches.com, geert@linux-m68k.org, netdev@vger.kernel.org, workflows@vger.kernel.org, mario.limonciello@amd.com Subject: [PATCH] scripts: checkpatch: steer people away from using file paths Date: Tue, 25 Jul 2023 08:59:26 -0700 Message-ID: <20230725155926.2775416-1-kuba@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: workflows@vger.kernel.org We repeatedly see noobs misuse get_maintainer by running it on the file paths rather than the patchfile. This leads to authors of changes (quoted commits and commits under Fixes) not getting CCed. These are usually the best reviewers! The file option should really not be used by noobs, unless they are just trying to find a maintainer to manually contact. Print a warning when someone tries to use -f and remove the "auto-guessing" of file paths. This script may break people's "scripts on top of get_maintainer" if they are using -f... but that's the point. Signed-off-by: Jakub Kicinski --- This is what I had in mind. CC: joe@perches.com Cc: geert@linux-m68k.org Cc: krzk@kernel.org Cc: netdev@vger.kernel.org Cc: workflows@vger.kernel.org Cc: mario.limonciello@amd.com --- scripts/get_maintainer.pl | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl index ab123b498fd9..3635b3d40ebe 100755 --- a/scripts/get_maintainer.pl +++ b/scripts/get_maintainer.pl @@ -51,6 +51,7 @@ my $output_roles = 0; my $output_rolestats = 1; my $output_section_maxlen = 50; my $scm = 0; +my $silence_file_warning = 0; my $tree = 1; my $web = 0; my $subsystem = 0; @@ -267,6 +268,7 @@ if (!GetOptions( 'subsystem!' => \$subsystem, 'status!' => \$status, 'scm!' => \$scm, + 'silence-file-warning!' => \$silence_file_warning, 'tree!' => \$tree, 'web!' => \$web, 'letters=s' => \$letters, @@ -544,7 +546,13 @@ foreach my $file (@ARGV) { if ($from_filename && (vcs_exists() && !vcs_file_exists($file))) { warn "$P: file '$file' not found in version control $!\n"; } - if ($from_filename || ($file ne "&STDIN" && vcs_file_exists($file))) { + if ($from_filename) { + if (!$silence_file_warning) { + warn "$P: WARNING: Prefer running the script on patches as " + . "generated by git format-patch. Selecting paths is known " + . "to miss recipients!\n"; + } + $file =~ s/^\Q${cur_path}\E//; #strip any absolute path $file =~ s/^\Q${lk_path}\E//; #or the path to the lk tree push(@files, $file); @@ -1081,6 +1089,7 @@ version: $V --mailmap => use .mailmap file (default: $email_use_mailmap) --no-tree => run without a kernel tree --self-test => show potential issues with MAINTAINERS file content + --silence-file-warning => silence the warning about -f being used (see Notes) --version => show version --help => show this help information @@ -1089,6 +1098,10 @@ version: $V --pattern-depth=0 --remove-duplicates --rolestats] Notes: + Using "-f file" is generally discouraged, running the script on a filepatch + (as generated by git format-patch) is usually the right thing to do. + Commit message is an integral part of the change and $P + will extract additional information from it (keywords, Fixes tags etc.) Using "-f directory" may give unexpected results: Used with "--git", git signators for _all_ files in and below directory are examined as git recurses directories. -- 2.41.0