Skip to contentSkip to conversation

scripts: strip leading './' when searching MAINTAINERS file

PATCH In review Daniel P. Berrangé 2 participants 2 messages May 11 GET_MAINTAINER script

lore
Share & tools
lore
#0 lore raw

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

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é" <[email protected]> (commit_signer:4/7=57%) "Michael S. Tsirkin" <[email protected]> (commit_signer:4/7=57%) Xiaoyao Li <[email protected]> (commit_signer:3/7=43%) Thomas Huth <[email protected]> (commit_signer:3/7=43%) Zhao Liu <[email protected]> (commit_signer:3/7=43%) [email protected] (open list:All patches CC here)

  $ ./scripts/get_maintainer.pl -f hw/net/vmxnet3.c
  Dmitry Fleytman <[email protected]> (maintainer:VMware)
  Jason Wang <[email protected]> (odd fixer:Network devices)
  [email protected] (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.

---
 scripts/get_maintainer.pl | 1 +
 1 file changed, 1 insertion(+)
scripts/get_maintainer.pl +1 -0
index 00a0870b26..76be402e11 100755
@@ -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);
Signature · 1 line
2.54.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 22 lines · Daniel P. Berrangé

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é" <[email protected]> (commit_signer:4/7=57%) "Michael S. Tsirkin" <[email protected]> (commit_signer:4/7=57%) Xiaoyao Li <[email protected]> (commit_signer:3/7=43%) Thomas Huth <[email protected]> (commit_signer:3/7=43%) Zhao Liu <[email protected]> (commit_signer:3/7=43%) [email protected] (open list:All patches CC here)

   $ ./scripts/get_maintainer.pl -f hw/net/vmxnet3.c
   Dmitry Fleytman <[email protected]> (maintainer:VMware)
   Jason Wang <[email protected]> (odd fixer:Network devices)
   [email protected] (open list:All patches CC here)

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

Quoted 8 lines

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.

---
  scripts/get_maintainer.pl | 1 +
  1 file changed, 1 insertion(+)