[PATCH] scripts: strip leading './' when searching MAINTAINERS file

Daniel P. Berrangé posted 1 patch 2 weeks, 5 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260511093858.82753-1-berrange@redhat.com
scripts/get_maintainer.pl | 1 +
1 file changed, 1 insertion(+)
[PATCH] scripts: strip leading './' when searching MAINTAINERS file
Posted by Daniel P. Berrangé 2 weeks, 5 days ago
The following two uses of get_maintainer.pl should return the
same results, but do not:

  $ ./scripts/get_maintainer.pl -f ./hw/net/vmxnet3.c
  get_maintainer.pl: No maintainers found, printing recent contributors.
  get_maintainer.pl: Do not blindly cc: them on patches!  Use common sense.

  "Philippe Mathieu-Daudé" <philmd@linaro.org> (commit_signer:4/7=57%)
  "Michael S. Tsirkin" <mst@redhat.com> (commit_signer:4/7=57%)
  Xiaoyao Li <xiaoyao.li@intel.com> (commit_signer:3/7=43%)
  Thomas Huth <thuth@redhat.com> (commit_signer:3/7=43%)
  Zhao Liu <zhao1.liu@intel.com> (commit_signer:3/7=43%)
  qemu-devel@nongnu.org (open list:All patches CC here)

  $ ./scripts/get_maintainer.pl -f hw/net/vmxnet3.c
  Dmitry Fleytman <dmitry.fleytman@gmail.com> (maintainer:VMware)
  Jason Wang <jasowang@redhat.com> (odd fixer:Network devices)
  qemu-devel@nongnu.org (open list:All patches CC here)

In the former case, the leading "./" needs to be removed before
trying to find a filename match.

Blindly stripping the "./" is valid because the script already
enforces that it is run from the QEMU git root directory, so
canonicalizing the filename vs $CWD is not required.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 scripts/get_maintainer.pl | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index 00a0870b26..76be402e11 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -384,6 +384,7 @@ foreach my $file (@ARGV) {
 	} elsif (!(stat $file)) {
 	    die "$P: file '${file}' not found: $!\n";
 	}
+	$file =~ s,^./,,;
     }
     if ($from_filename) {
 	push(@files, $file);
-- 
2.54.0


Re: [PATCH] scripts: strip leading './' when searching MAINTAINERS file
Posted by Philippe Mathieu-Daudé 2 weeks, 5 days ago
On 11/5/26 11:38, Daniel P. Berrangé wrote:
> The following two uses of get_maintainer.pl should return the
> same results, but do not:
> 
>    $ ./scripts/get_maintainer.pl -f ./hw/net/vmxnet3.c
>    get_maintainer.pl: No maintainers found, printing recent contributors.
>    get_maintainer.pl: Do not blindly cc: them on patches!  Use common sense.
> 
>    "Philippe Mathieu-Daudé" <philmd@linaro.org> (commit_signer:4/7=57%)
>    "Michael S. Tsirkin" <mst@redhat.com> (commit_signer:4/7=57%)
>    Xiaoyao Li <xiaoyao.li@intel.com> (commit_signer:3/7=43%)
>    Thomas Huth <thuth@redhat.com> (commit_signer:3/7=43%)
>    Zhao Liu <zhao1.liu@intel.com> (commit_signer:3/7=43%)
>    qemu-devel@nongnu.org (open list:All patches CC here)
> 
>    $ ./scripts/get_maintainer.pl -f hw/net/vmxnet3.c
>    Dmitry Fleytman <dmitry.fleytman@gmail.com> (maintainer:VMware)
>    Jason Wang <jasowang@redhat.com> (odd fixer:Network devices)
>    qemu-devel@nongnu.org (open list:All patches CC here)
> 
> In the former case, the leading "./" needs to be removed before
> trying to find a filename match.
> 
> Blindly stripping the "./" is valid because the script already
> enforces that it is run from the QEMU git root directory, so
> canonicalizing the filename vs $CWD is not required.
> 
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>   scripts/get_maintainer.pl | 1 +
>   1 file changed, 1 insertion(+)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>