2023-06-28 20:37:43

by Ahelenia Ziemiańska

[permalink] [raw]
Subject: [PATCH] checkpatch: don't take signature to be part of the commit SHA

I had just received:
$ scripts/checkpatch.pl 0001-splice-always-fsnotify_access-in-fsnotify_modify-out.patch
WARNING: Please use correct Fixes: style 'Fixes: <12 chars of sha1> ("<title line>")' - ie: 'Fixes: gpg: Signatu (":35 CEST")'
#25:
Fixes: 983652c69199 ("splice: report related fsnotify events")

total: 0 errors, 1 warnings, 60 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.

0001-splice-always-fsnotify_access-in-fsnotify_modify-out.patch has style problems, please review.

NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.

This fails when the Fixes:ed SHAs are signed, since the output is
$ git log --format='%H %s'
gpg: Signature made Wed 28 Jun 2023 19:05:02 CEST
gpg: using RSA key 7D69474E84028C5CC0C44163BCFD0B018D2658F1
gpg: Good signature from "наб <[email protected]>" [ultimate]
gpg: aka "наб <[email protected]>" [ultimate]
gpg: aka "nabijaczleweli <[email protected]>" [ultimate]
53307062b2b644dc0de7bde916d6193492f37643 splice: fsnotify_access(in), fsnotify_modify(out) on success in tee
or
$ git log --format='%H %s' 983652c69199
gpg: Signature made Tue 04 Apr 2023 15:57:35 CEST
gpg: using EDDSA key 408734571EA70C78B332692891C61BC06578DCA2
gpg: Can't check signature: No public key
983652c691990b3257a07f67f4263eb847baa82d splice: report related fsnotify events

The fix mimicks what was done in commit f24fb53984cf ("perf tools: Don't
include signature in version strings"): just don't ask for the
signatures being validated.

With this, my patch passed validation.

Signed-off-by: Ahelenia Ziemiańska <[email protected]>
---
Grepped through for /log /, /show /, and /git_command/, and this
is all I found. Unsure if there's other git executions that need
to be fixed, tho.

scripts/checkpatch.pl | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index b30114d637c4..d3a682bc9c20 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1164,7 +1164,7 @@ sub seed_camelcase_includes {
$camelcase_seeded = 1;

if (-e "$gitroot") {
- my $git_last_include_commit = `${git_command} log --no-merges --pretty=format:"%h%n" -1 -- include`;
+ my $git_last_include_commit = `${git_command} log --no-show-signature --no-merges --pretty=format:"%h%n" -1 -- include`;
chomp $git_last_include_commit;
$camelcase_cache = ".checkpatch-camelcase.git.$git_last_include_commit";
} else {
@@ -1226,7 +1226,7 @@ sub git_commit_info {

return ($id, $desc) if ((which("git") eq "") || !(-e "$gitroot"));

- my $output = `${git_command} log --no-color --format='%H %s' -1 $commit 2>&1`;
+ my $output = `${git_command} log --no-show-signature --no-color --format='%H %s' -1 $commit 2>&1`;
$output =~ s/^\s*//gm;
my @lines = split("\n", $output);

@@ -1277,7 +1277,7 @@ if ($git) {
} else {
$git_range = "-1 $commit_expr";
}
- my $lines = `${git_command} log --no-color --no-merges --pretty=format:'%H %s' $git_range`;
+ my $lines = `${git_command} log --no-show-signature --no-color --no-merges --pretty=format:'%H %s' $git_range`;
foreach my $line (split(/\n/, $lines)) {
$line =~ /^([0-9a-fA-F]{40,40}) (.*)$/;
next if (!defined($1) || !defined($2));
--
2.39.2


Attachments:
(No filename) (3.54 kB)
signature.asc (849.00 B)
Download all attachments

2023-06-29 04:26:27

by Joe Perches

[permalink] [raw]
Subject: Re: [PATCH] checkpatch: don't take signature to be part of the commit SHA

On Wed, 2023-06-28 at 22:35 +0200, Ahelenia Ziemiańska wrote:
> I had just received:
> $ scripts/checkpatch.pl 0001-splice-always-fsnotify_access-in-fsnotify_modify-out.patch
> WARNING: Please use correct Fixes: style 'Fixes: <12 chars of sha1> ("<title line>")' - ie: 'Fixes: gpg: Signatu (":35 CEST")'
> #25:
> Fixes: 983652c69199 ("splice: report related fsnotify events")
>
> total: 0 errors, 1 warnings, 60 lines checked
>
> NOTE: For some of the reported defects, checkpatch may be able to
> mechanically convert to the typical style using --fix or --fix-inplace.
>
> 0001-splice-always-fsnotify_access-in-fsnotify_modify-out.patch has style problems, please review.
>
> NOTE: If any of the errors are false positives, please report
> them to the maintainer, see CHECKPATCH in MAINTAINERS.
>
> This fails when the Fixes:ed SHAs are signed, since the output is
> $ git log --format='%H %s'
> gpg: Signature made Wed 28 Jun 2023 19:05:02 CEST
> gpg: using RSA key 7D69474E84028C5CC0C44163BCFD0B018D2658F1
> gpg: Good signature from "наб <[email protected]>" [ultimate]
> gpg: aka "наб <[email protected]>" [ultimate]
> gpg: aka "nabijaczleweli <[email protected]>" [ultimate]
> 53307062b2b644dc0de7bde916d6193492f37643 splice: fsnotify_access(in), fsnotify_modify(out) on success in tee
> or
> $ git log --format='%H %s' 983652c69199
> gpg: Signature made Tue 04 Apr 2023 15:57:35 CEST
> gpg: using EDDSA key 408734571EA70C78B332692891C61BC06578DCA2
> gpg: Can't check signature: No public key
> 983652c691990b3257a07f67f4263eb847baa82d splice: report related fsnotify events
>
> The fix mimicks what was done in commit f24fb53984cf ("perf tools: Don't

mimics

> include signature in version strings"): just don't ask for the
> signatures being validated.
>
> With this, my patch passed validation.
>
> Signed-off-by: Ahelenia Ziemiańska <[email protected]>
> ---
> Grepped through for /log /, /show /, and /git_command/, and this
> is all I found. Unsure if there's other git executions that need
> to be fixed, tho.

Not sure either but perhaps these should be in some
negative options variable like:

my $git_log_no = "--no-show-signature --no-merges --no-color";

> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -1164,7 +1164,7 @@ sub seed_camelcase_includes {
> $camelcase_seeded = 1;
>
> if (-e "$gitroot") {
> - my $git_last_include_commit = `${git_command} log --no-merges --pretty=format:"%h%n" -1 -- include`;
> + my $git_last_include_commit = `${git_command} log --no-show-signature --no-merges --pretty=format:"%h%n" -1 -- include`;

my $git_last_include_commit = `${git_command} log ${git_log_no} --pretty=...

etc...


2023-06-29 12:47:05

by Ahelenia Ziemiańska

[permalink] [raw]
Subject: Re: [PATCH] checkpatch: don't take signature to be part of the commit SHA

On Wed, Jun 28, 2023 at 09:11:00PM -0700, Joe Perches wrote:
> On Wed, 2023-06-28 at 22:35 +0200, Ahelenia Ziemiańska wrote:
> > Grepped through for /log /, /show /, and /git_command/, and this
> > is all I found. Unsure if there's other git executions that need
> > to be fixed, tho.
> Not sure either but perhaps these should be in some
> negative options variable like:
>
> my $git_log_no = "--no-show-signature --no-merges --no-color";
>
> > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> []
> > @@ -1164,7 +1164,7 @@ sub seed_camelcase_includes {
> > $camelcase_seeded = 1;
> >
> > if (-e "$gitroot") {
> > - my $git_last_include_commit = `${git_command} log --no-merges --pretty=format:"%h%n" -1 -- include`;
> > + my $git_last_include_commit = `${git_command} log --no-show-signature --no-merges --pretty=format:"%h%n" -1 -- include`;
> my $git_last_include_commit = `${git_command} log ${git_log_no} --pretty=...
git_commit_info doesn't use --no-merges, and so that'd change the
behaviour of "fixes: xxx"/"commit xxx" thusly:
$ git log --no-show-signature --no-color --format="%H %s" -1 e3b2e2c14bcc12da2c463a7179db39139f682573
e3b2e2c14bcc12da2c463a7179db39139f682573 Merge tag 'i2c-for-6.4-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux
$ git log --no-show-signature --no-merges --no-color --format="%H %s" -1 e3b2e2c14bcc12da2c463a7179db39139f682573
afa4bb778e48d79e4a642ed41e3b4e0de7489a6c workqueue: clean up WORK_* constant types, clarify masking
(flattening a referenced merge to its first parent).

Just confirming that's what we want, because I wouldn't think it is?


Attachments:
(No filename) (1.62 kB)
signature.asc (849.00 B)
Download all attachments

2023-07-03 15:24:42

by Ahelenia Ziemiańska

[permalink] [raw]
Subject: [PATCH v2] checkpatch: don't take signature to be part of the commit SHA

I had just received:
$ scripts/checkpatch.pl 0001-splice-always-fsnotify_access-in-fsnotify_modify-out.patch
WARNING: Please use correct Fixes: style 'Fixes: <12 chars of sha1> ("<title line>")' - ie: 'Fixes: gpg: Signatu (":35 CEST")'
#25:
Fixes: 983652c69199 ("splice: report related fsnotify events")

total: 0 errors, 1 warnings, 60 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.

0001-splice-always-fsnotify_access-in-fsnotify_modify-out.patch has style problems, please review.

NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.

This fails when the Fixes:ed SHAs are signed, since the output is
$ git log --format='%H %s'
gpg: Signature made Wed 28 Jun 2023 19:05:02 CEST
gpg: using RSA key 7D69474E84028C5CC0C44163BCFD0B018D2658F1
gpg: Good signature from "наб <[email protected]>" [ultimate]
gpg: aka "наб <[email protected]>" [ultimate]
gpg: aka "nabijaczleweli <[email protected]>" [ultimate]
53307062b2b644dc0de7bde916d6193492f37643 splice: fsnotify_access(in), fsnotify_modify(out) on success in tee
or
$ git log --format='%H %s' 983652c69199
gpg: Signature made Tue 04 Apr 2023 15:57:35 CEST
gpg: using EDDSA key 408734571EA70C78B332692891C61BC06578DCA2
gpg: Can't check signature: No public key
983652c691990b3257a07f67f4263eb847baa82d splice: report related fsnotify events

The fix mimics what was done in commit f24fb53984cf ("perf tools: Don't
include signature in version strings"): just don't ask for the
signatures being validated.

With this, my patch passed validation.

Signed-off-by: Ahelenia Ziemiańska <[email protected]>
---
scripts/checkpatch.pl | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index b30114d637c4..1ff2c9835245 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -71,6 +71,7 @@ my $color = "auto";
my $allow_c99_comments = 1; # Can be overridden by --ignore C99_COMMENT_TOLERANCE
# git output parsing needs US English output, so first set backtick child process LANGUAGE
my $git_command ='export LANGUAGE=en_US.UTF-8; git';
+my $git_log_no = "--no-show-signature --no-color";
my $tabsize = 8;
my ${CONFIG_} = "CONFIG_";

@@ -1164,7 +1165,7 @@ sub seed_camelcase_includes {
$camelcase_seeded = 1;

if (-e "$gitroot") {
- my $git_last_include_commit = `${git_command} log --no-merges --pretty=format:"%h%n" -1 -- include`;
+ my $git_last_include_commit = `${git_command} log ${git_log_no} --no-merges --pretty=format:"%h%n" -1 -- include`;
chomp $git_last_include_commit;
$camelcase_cache = ".checkpatch-camelcase.git.$git_last_include_commit";
} else {
@@ -1226,7 +1227,7 @@ sub git_commit_info {

return ($id, $desc) if ((which("git") eq "") || !(-e "$gitroot"));

- my $output = `${git_command} log --no-color --format='%H %s' -1 $commit 2>&1`;
+ my $output = `${git_command} log ${git_log_no} --format='%H %s' -1 $commit 2>&1`;
$output =~ s/^\s*//gm;
my @lines = split("\n", $output);

@@ -1277,7 +1278,7 @@ if ($git) {
} else {
$git_range = "-1 $commit_expr";
}
- my $lines = `${git_command} log --no-color --no-merges --pretty=format:'%H %s' $git_range`;
+ my $lines = `${git_command} log ${git_log_no} --no-merges --pretty=format:'%H %s' $git_range`;
foreach my $line (split(/\n/, $lines)) {
$line =~ /^([0-9a-fA-F]{40,40}) (.*)$/;
next if (!defined($1) || !defined($2));
--
2.39.2


Attachments:
(No filename) (3.71 kB)
signature.asc (849.00 B)
Download all attachments

2023-07-31 13:29:18

by Ahelenia Ziemiańska

[permalink] [raw]
Subject: [PATCH RESEND v2] checkpatch: don't take signature to be part of the commit SHA

I had just received:
$ scripts/checkpatch.pl 0001-splice-always-fsnotify_access-in-fsnotify_modify-out.patch
WARNING: Please use correct Fixes: style 'Fixes: <12 chars of sha1> ("<title line>")' - ie: 'Fixes: gpg: Signatu (":35 CEST")'
#25:
Fixes: 983652c69199 ("splice: report related fsnotify events")

total: 0 errors, 1 warnings, 60 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.

0001-splice-always-fsnotify_access-in-fsnotify_modify-out.patch has style problems, please review.

NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.

This fails when the Fixes:ed SHAs are signed, since the output is
$ git log --format='%H %s'
gpg: Signature made Wed 28 Jun 2023 19:05:02 CEST
gpg: using RSA key 7D69474E84028C5CC0C44163BCFD0B018D2658F1
gpg: Good signature from "наб <[email protected]>" [ultimate]
gpg: aka "наб <[email protected]>" [ultimate]
gpg: aka "nabijaczleweli <[email protected]>" [ultimate]
53307062b2b644dc0de7bde916d6193492f37643 splice: fsnotify_access(in), fsnotify_modify(out) on success in tee
or
$ git log --format='%H %s' 983652c69199
gpg: Signature made Tue 04 Apr 2023 15:57:35 CEST
gpg: using EDDSA key 408734571EA70C78B332692891C61BC06578DCA2
gpg: Can't check signature: No public key
983652c691990b3257a07f67f4263eb847baa82d splice: report related fsnotify events

The fix mimics what was done in commit f24fb53984cf ("perf tools: Don't
include signature in version strings"): just don't ask for the
signatures being validated.

With this, my patch passed validation.

Signed-off-by: Ahelenia Ziemiańska <[email protected]>
---
No-change rebase of v2.

scripts/checkpatch.pl | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 880fde13d9b8..734c7d4a4ac7 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -71,6 +71,7 @@ my $color = "auto";
my $allow_c99_comments = 1; # Can be overridden by --ignore C99_COMMENT_TOLERANCE
# git output parsing needs US English output, so first set backtick child process LANGUAGE
my $git_command ='export LANGUAGE=en_US.UTF-8; git';
+my $git_log_no = "--no-show-signature --no-color";
my $tabsize = 8;
my ${CONFIG_} = "CONFIG_";

@@ -1164,7 +1165,7 @@ sub seed_camelcase_includes {
$camelcase_seeded = 1;

if (-e "$gitroot") {
- my $git_last_include_commit = `${git_command} log --no-merges --pretty=format:"%h%n" -1 -- include`;
+ my $git_last_include_commit = `${git_command} log ${git_log_no} --no-merges --pretty=format:"%h%n" -1 -- include`;
chomp $git_last_include_commit;
$camelcase_cache = ".checkpatch-camelcase.git.$git_last_include_commit";
} else {
@@ -1226,7 +1227,7 @@ sub git_commit_info {

return ($id, $desc) if ((which("git") eq "") || !(-e "$gitroot"));

- my $output = `${git_command} log --no-color --format='%H %s' -1 $commit 2>&1`;
+ my $output = `${git_command} log ${git_log_no} --format='%H %s' -1 $commit 2>&1`;
$output =~ s/^\s*//gm;
my @lines = split("\n", $output);

@@ -1277,7 +1278,7 @@ if ($git) {
} else {
$git_range = "-1 $commit_expr";
}
- my $lines = `${git_command} log --no-color --no-merges --pretty=format:'%H %s' $git_range`;
+ my $lines = `${git_command} log ${git_log_no} --no-merges --pretty=format:'%H %s' $git_range`;
foreach my $line (split(/\n/, $lines)) {
$line =~ /^([0-9a-fA-F]{40,40}) (.*)$/;
next if (!defined($1) || !defined($2));
--
2.39.2


Attachments:
(No filename) (3.74 kB)
signature.asc (849.00 B)
Download all attachments