2021-11-16 21:34:21

by Łukasz Stelmach

[permalink] [raw]
Subject: [PATCH 1/2] get_maintainer: look for configuration files in ./scripts

Change ".scripts" to "./scripts" as described in commit bcde44ed7d2a
("scripts/get_maintainer.pl: use .get_maintainer.conf from . then $HOME
then scripts").

Enumerate paths to search directly in an array instead of joining and
splitting.

Fixes: bcde44ed7d2a ("scripts/get_maintainer.pl: use .get_maintainer.conf from . then $HOME then scripts").
Signed-off-by: Łukasz Stelmach <[email protected]>
---
scripts/get_maintainer.pl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index 2075db0c08b8..ff10c2878522 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -1478,7 +1478,7 @@ sub which {
sub which_conf {
my ($conf) = @_;

- foreach my $path (split(/:/, ".:$ENV{HOME}:.scripts")) {
+ foreach my $path (".", "$ENV{HOME}", "./scripts") {
if (-e "$path/$conf") {
return "$path/$conf";
}
--
2.30.2



2021-11-16 21:34:23

by Łukasz Stelmach

[permalink] [raw]
Subject: [PATCH 2/2] get_maintainer: ignore "my" e-mail address

Ignore one's own e-mail address given as a parameter to --ignore-me
or in the EMAIL environment variable.

Signed-off-by: Łukasz Stelmach <[email protected]>
---
scripts/get_maintainer.pl | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)

diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index ff10c2878522..0719d575c682 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -42,6 +42,7 @@ my $email_git_max_maintainers = 5;
my $email_git_min_percent = 5;
my $email_git_since = "1-year-ago";
my $email_hg_since = "-365";
+my $email_ignore_me = undef;
my $interactive = 0;
my $email_remove_duplicates = 1;
my $email_use_mailmap = 1;
@@ -251,6 +252,7 @@ if (!GetOptions(
'git-since=s' => \$email_git_since,
'hg-since=s' => \$email_hg_since,
'i|interactive!' => \$interactive,
+ 'ignore-me:s' => \$email_ignore_me,
'remove-duplicates!' => \$email_remove_duplicates,
'mailmap!' => \$email_use_mailmap,
'm!' => \$email_maintainer,
@@ -338,6 +340,17 @@ if ($tree && !top_of_kernel_tree($lk_path)) {
. "a linux kernel source tree.\n";
}

+if (defined $email_ignore_me) {
+ if ($email_ignore_me && rfc822_valid($email_ignore_me)) {
+ (undef, $email_ignore_me) = parse_email($email_ignore_me);
+ } elsif (!$email_ignore_me && defined $ENV{EMAIL} && rfc822_valid($ENV{EMAIL})) {
+ (undef, $email_ignore_me) = parse_email($ENV{EMAIL});
+ } else {
+ warn "$P: \"$email_ignore_me\" is not a valid e-mail address\n";
+ $email_ignore_me = 0;
+ }
+}
+
## Read MAINTAINERS for type/value pairs

my @typevalue = ();
@@ -1062,6 +1075,8 @@ MAINTAINER field selection options:
--rolestats => show roles and statistics (commits/total_commits, %)
--file-emails => add email addresses found in -f file (default: 0 (off))
--fixes => for patches, add signatures of commits with 'Fixes: <commit>' (default: 1 (on))
+ --ignore-me => ignore one's own e-mail address passed as a parameter or
+ via EMAIL environment variable
--scm => print SCM tree(s) if any
--status => print status if any
--subsystem => print subsystem name if any
@@ -1401,6 +1416,11 @@ sub push_email_address {
return 0;
}

+ if ($email_ignore_me) {
+ my ($myname, $myaddr) = parse_email($email_ignore_me);
+ return 0 if ($address eq $myaddr)
+ }
+
if (!$email_remove_duplicates) {
push(@email_to, [format_email($name, $address, $email_usename), $role]);
} elsif (!email_inuse($name, $address)) {
--
2.30.2


2021-11-16 21:56:34

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH 1/2] get_maintainer: look for configuration files in ./scripts

On Tue, 16 Nov 2021 22:34:01 +0100 Łukasz Stelmach <[email protected]> wrote:

> Change ".scripts" to "./scripts" as described in commit bcde44ed7d2a
> ("scripts/get_maintainer.pl: use .get_maintainer.conf from . then $HOME
> then scripts").

Won't this break people who are using ".scripts"?

If so, we should either leave it as-is and update the documentation
(which doesn't appear to exist) or to newly add ./scripts and leave
.scripts unaltered.



2021-11-16 23:10:26

by Joe Perches

[permalink] [raw]
Subject: Re: [PATCH 1/2] get_maintainer: look for configuration files in ./scripts

On Tue, 2021-11-16 at 22:34 +0100, Łukasz Stelmach wrote:
> Change ".scripts" to "./scripts" as described in commit bcde44ed7d2a
> ("scripts/get_maintainer.pl: use .get_maintainer.conf from . then $HOME
> then scripts").

The intent there was to use the <kernel_tree>/scripts directory
Adding . to that would change that.



2021-11-16 23:14:41

by Joe Perches

[permalink] [raw]
Subject: Re: [PATCH 2/2] get_maintainer: ignore "my" e-mail address

On Tue, 2021-11-16 at 22:34 +0100, Łukasz Stelmach wrote:
> Ignore one's own e-mail address given as a parameter to --ignore-me
> or in the EMAIL environment variable.

Why is this useful?

git send-email already supports this.

--suppress-cc=<category>
Specify an additional category of recipients to suppress the auto-cc of:

• author will avoid including the patch author

• self will avoid including the sender

--[no-]suppress-from
If this is set, do not add the From: address to the cc: list. Default is the value of sendemail.suppressFrom configuration value; if that
is unspecified, default to --no-suppress-from.



2021-11-17 12:08:18

by Łukasz Stelmach

[permalink] [raw]
Subject: Re: [PATCH 1/2] get_maintainer: look for configuration files in ./scripts

It was <2021-11-16 wto 15:10>, when Joe Perches wrote:
> On Tue, 2021-11-16 at 22:34 +0100, Łukasz Stelmach wrote:
>> Change ".scripts" to "./scripts" as described in commit bcde44ed7d2a
>> ("scripts/get_maintainer.pl: use .get_maintainer.conf from . then $HOME
>> then scripts").
>
> The intent there was to use the <kernel_tree>/scripts directory

I am afraid bcde44ed7d2a[1] removed references to ${lk_path} and made
git_maintainer.pl look for the files in the directory the script is
invoked from.

> Adding . to that would change that.

Andrew points out[2] that some we might need to include .scripts
too. Where do we expect the config files to be (do comment)?

. - current directory (?)
${lk_path}/ - the top directory of source tree
${HOME}/ - per-user
${lk_path}/scripts - how is this dfferent from ${lk_path}?
${lk_path}/.scripts - Andrew says someone might have started using it

I'd also add in this commit or another
${XDG_CONFIG_HOME}/get_maintainers. However, I think files in this
directory should be named conf and ignore instead of
.get_maintainer.conf and get_maintainer.ignore (respectively).


[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=bcde44ed7d2a
[2] https://lore.kernel.org/lkml/[email protected]/
--
Łukasz Stelmach
Samsung R&D Institute Poland
Samsung Electronics


Attachments:
signature.asc (487.00 B)

2021-11-25 16:16:25

by Łukasz Stelmach

[permalink] [raw]
Subject: Re: [PATCH 2/2] get_maintainer: ignore "my" e-mail address

It was <2021-11-16 wto 15:14>, when Joe Perches wrote:
> On Tue, 2021-11-16 at 22:34 +0100, Łukasz Stelmach wrote:
>> Ignore one's own e-mail address given as a parameter to --ignore-me
>> or in the EMAIL environment variable.
>
> Why is this useful?
>
> git send-email already supports this.
>
> --suppress-cc=<category>
> Specify an additional category of recipients to suppress
> the auto-cc of:
>
> • author will avoid including the patch author
>
> • self will avoid including the sender
>
> --[no-]suppress-from
> If this is set, do not add the From: address to the cc:
> list. Default is the value of sendemail.suppressFrom
> configuration value; if that is unspecified, default to
> --no-suppress-from.
>

Not really, git send-email does not support --suppress-to, and with
get_maintainers.pl coupled with git send-email as follows

--8<---------------cut here---------------start------------->8---
[sendemail]
tocmd = "`pwd`/scripts/get_maintainer.pl --nogit --nogit-fallback --norolestats --nol --"
cccmd = "`pwd`/scripts/get_maintainer.pl --nogit --nogit-fallback --norolestats --nom --nor --nofixes --"
--8<---------------cut here---------------end--------------->8---

my address is added to To: if I am a maintainer of the patched files.
To avoid this the --ignore-me options can be added to tocmd.

--
Łukasz Stelmach
Samsung R&D Institute Poland
Samsung Electronics


Attachments:
signature.asc (487.00 B)

2021-11-25 16:37:36

by Joe Perches

[permalink] [raw]
Subject: Re: [PATCH 2/2] get_maintainer: ignore "my" e-mail address

On Thu, 2021-11-25 at 17:14 +0100, Lukasz Stelmach wrote:
> It was <2021-11-16 wto 15:14>, when Joe Perches wrote:
> > On Tue, 2021-11-16 at 22:34 +0100, Łukasz Stelmach wrote:
> > > Ignore one's own e-mail address given as a parameter to --ignore-me
> > > or in the EMAIL environment variable.
> >
> > Why is this useful?
> >
> > git send-email already supports this.
> >
> > --suppress-cc=<category>
> > Specify an additional category of recipients to suppress
> > the auto-cc of:
> >
> > • author will avoid including the patch author
> >
> > • self will avoid including the sender
> >
> > --[no-]suppress-from
> > If this is set, do not add the From: address to the cc:
> > list. Default is the value of sendemail.suppressFrom
> > configuration value; if that is unspecified, default to
> > --no-suppress-from.
> >
>
> Not really, git send-email does not support --suppress-to, and with
> get_maintainers.pl coupled with git send-email as follows
>
> --8<---------------cut here---------------start------------->8---
> [sendemail]
> tocmd = "`pwd`/scripts/get_maintainer.pl --nogit --nogit-fallback --norolestats --nol --"
> cccmd = "`pwd`/scripts/get_maintainer.pl --nogit --nogit-fallback --norolestats --nom --nor --nofixes --"
> --8<---------------cut here---------------end--------------->8---
>
> my address is added to To: if I am a maintainer of the patched files.
> To avoid this the --ignore-me options can be added to tocmd.
>



2021-11-25 17:03:35

by Joe Perches

[permalink] [raw]
Subject: Re: [PATCH 2/2] get_maintainer: ignore "my" e-mail address

(I dislike my email client sometimes, apologies for the blank reply)

On Thu, 2021-11-25 at 17:14 +0100, Lukasz Stelmach wrote:
> It was <2021-11-16 wto 15:14>, when Joe Perches wrote:
> > On Tue, 2021-11-16 at 22:34 +0100, Łukasz Stelmach wrote:
> > > Ignore one's own e-mail address given as a parameter to --ignore-me
> > > or in the EMAIL environment variable.
> >
> > Why is this useful?
> >
> > git send-email already supports this.
> >
> > --suppress-cc=<category>
> > Specify an additional category of recipients to suppress
> > the auto-cc of:
> >
> > • author will avoid including the patch author
> >
> > • self will avoid including the sender
> >
> > --[no-]suppress-from
> > If this is set, do not add the From: address to the cc:
> > list. Default is the value of sendemail.suppressFrom
> > configuration value; if that is unspecified, default to
> > --no-suppress-from.
> >
>
> Not really, git send-email does not support --suppress-to, and with
> get_maintainers.pl coupled with git send-email as follows
>
> --8<---------------cut here---------------start------------->8---
> [sendemail]
> tocmd = "`pwd`/scripts/get_maintainer.pl --nogit --nogit-fallback --norolestats --nol --"
> cccmd = "`pwd`/scripts/get_maintainer.pl --nogit --nogit-fallback --norolestats --nom --nor --nofixes --"
> --8<---------------cut here---------------end--------------->8---
>
> my address is added to To: if I am a maintainer of the patched files.
> To avoid this the --ignore-me options can be added to tocmd.

Rather than add complexity to the original get_maintainer script, is
it possible to add a pipe like " | grep -v '<your_address>'" to tocmd ?

I think it better to have these cmds use scripts ala:

https://lore.kernel.org/all/[email protected]/

And if not a script and the complexity is warranted (though I think not)
I'd rather have something like --suppress-addresss "<addr>" added to
get_maintainer.pl to allow one or more addresses to be suppressed.



2021-11-29 21:50:01

by Łukasz Stelmach

[permalink] [raw]
Subject: Re: [PATCH 2/2] get_maintainer: ignore "my" e-mail address

It was <2021-11-25 czw 09:01>, when Joe Perches wrote:
> On Thu, 2021-11-25 at 17:14 +0100, Lukasz Stelmach wrote:
>> It was <2021-11-16 wto 15:14>, when Joe Perches wrote:
>> > On Tue, 2021-11-16 at 22:34 +0100, Łukasz Stelmach wrote:
>> > > Ignore one's own e-mail address given as a parameter to --ignore-me
>> > > or in the EMAIL environment variable.
>> >
>> > Why is this useful?
>> >
>> > git send-email already supports this.
>> >
>> > --suppress-cc=<category>
>> > Specify an additional category of recipients to suppress
>> > the auto-cc of:
>> >
>> > • author will avoid including the patch author
>> >
>> > • self will avoid including the sender
>> >
>> > --[no-]suppress-from
>> > If this is set, do not add the From: address to the cc:
>> > list. Default is the value of sendemail.suppressFrom
>> > configuration value; if that is unspecified, default to
>> > --no-suppress-from.
>> >
>>
>> Not really, git send-email does not support --suppress-to, and with
>> get_maintainers.pl coupled with git send-email as follows
>>
>> --8<---------------cut here---------------start------------->8---
>> [sendemail]
>> tocmd = "`pwd`/scripts/get_maintainer.pl --nogit --nogit-fallback --norolestats --nol --"
>> cccmd = "`pwd`/scripts/get_maintainer.pl --nogit --nogit-fallback --norolestats --nom --nor --nofixes --"
>> --8<---------------cut here---------------end--------------->8---
>>
>> my address is added to To: if I am a maintainer of the patched files.
>> To avoid this the --ignore-me options can be added to tocmd.
>
> Rather than add complexity to the original get_maintainer script, is
> it possible to add a pipe like " | grep -v '<your_address>'" to tocmd ?
>
> I think it better to have these cmds use scripts ala:
>
> https://lore.kernel.org/all/[email protected]/

A thin wrapper is never a bad thing (-;

> And if not a script and the complexity is warranted (though I think not)
> I'd rather have something like --suppress-addresss "<addr>" added to
> get_maintainer.pl to allow one or more addresses to be suppressed.

Indeed, that sound a lot more reasonable. I'll probably go with wrappers
for now.

Thanks.
--
Łukasz Stelmach
Samsung R&D Institute Poland
Samsung Electronics


Attachments:
signature.asc (487.00 B)