Skip to contentSkip to conversation

kdb: Get rid of broken attempt to print CCVERSION in kdb summary

PATCH In review Douglas Anderson 5 participants 12 messages Mar 23, 2019 – May 7, 2019

Subsystems (2)
lore
Share & tools
lore

Douglas Anderson

author reviewer
#0 lore raw

PATCH 1/1 kdb: Get rid of broken attempt to print CCVERSION in kdb summary

If you drop into kdb and type "summary", it prints out a line that says this:

ccversion CCVERSION

...and I don't mean that it actually prints out the version of the C compiler. It literally prints out the string "CCVERSION".

The version of the C Compiler is already printed at boot up and it doesn't seem useful to replicate this in kdb. Let's just delete it. We can also delete the bit of the Makefile that called the C compiler in an attempt to pass this into kdb. This will remove one extra call to the C compiler at Makefile parse time and (very slightly) speed up builds.

---

 kernel/debug/kdb/Makefile   | 1 -
 kernel/debug/kdb/kdb_main.c | 1 -
 2 files changed, 2 deletions(-)
kernel/debug/kdb/Makefile +0 -1
index d4fc58f4b88d..efac857c5511 100644
@@ -6,7 +6,6 @@
 # Copyright (c) 2009 Wind River Systems, Inc. All Rights Reserved.
 #
 
-CCVERSION	:= $(shell $(CC) -v 2>&1 | sed -ne '$$p')
 obj-y := kdb_io.o kdb_main.o kdb_support.o kdb_bt.o gen-kdb_cmds.o kdb_bp.o kdb_debugger.o
 obj-$(CONFIG_KDB_KEYBOARD)    += kdb_keyboard.o
 
kernel/debug/kdb/kdb_main.c +0 -1
index 82a3b32a7cfc..fc96dbf8d9de 100644
@@ -2522,7 +2522,6 @@ static int kdb_summary(int argc, const char **argv)
 	kdb_printf("machine    %s\n", init_uts_ns.name.machine);
 	kdb_printf("nodename   %s\n", init_uts_ns.name.nodename);
 	kdb_printf("domainname %s\n", init_uts_ns.name.domainname);
-	kdb_printf("ccversion  %s\n", __stringify(CCVERSION));
 
 	now = __ktime_get_real_seconds();
 	time64_to_tm(now, 0, &tm);
Signature · 1 line
2.21.0.392.gf8f6787159e-goog
Reviewed-by on v1 1/1
#1 lore raw
Quoted 16 lines · Douglas Anderson

If you drop into kdb and type "summary", it prints out a line that says this:

ccversion CCVERSION

...and I don't mean that it actually prints out the version of the C compiler. It literally prints out the string "CCVERSION".

The version of the C Compiler is already printed at boot up and it doesn't seem useful to replicate this in kdb. Let's just delete it. We can also delete the bit of the Makefile that called the C compiler in an attempt to pass this into kdb. This will remove one extra call to the C compiler at Makefile parse time and (very slightly) speed up builds.

Quoted 2 lines

---

Quoted 31 lines
 kernel/debug/kdb/Makefile   | 1 -
 kernel/debug/kdb/kdb_main.c | 1 -
 2 files changed, 2 deletions(-)
kernel/debug/kdb/Makefile +0 -1
index d4fc58f4b88d..efac857c5511 100644
@@ -6,7 +6,6 @@
 # Copyright (c) 2009 Wind River Systems, Inc. All Rights Reserved.
 #
 
-CCVERSION      := $(shell $(CC) -v 2>&1 | sed -ne '$$p')
 obj-y := kdb_io.o kdb_main.o kdb_support.o kdb_bt.o gen-kdb_cmds.o kdb_bp.o kdb_debugger.o
 obj-$(CONFIG_KDB_KEYBOARD)    += kdb_keyboard.o
 
kernel/debug/kdb/kdb_main.c +0 -2
index 82a3b32a7cfc..fc96dbf8d9de 100644
@@ -2522,7 +2522,6 @@ static int kdb_summary(int argc, const char **argv)
        kdb_printf("machine    %s\n", init_uts_ns.name.machine);
        kdb_printf("nodename   %s\n", init_uts_ns.name.nodename);
        kdb_printf("domainname %s\n", init_uts_ns.name.domainname);
-       kdb_printf("ccversion  %s\n", __stringify(CCVERSION));
 
        now = __ktime_get_real_seconds();
        time64_to_tm(now, 0, &tm);
--

2.21.0.392.gf8f6787159e-goog

Signature · 2 lines
Best Regards
Masahiro Yamada
Reviewed-by on v1 1/1
#2 lore raw
In reply to Douglas Anderson

Hi Andrew,

Quoted 9 lines · Douglas Anderson

If you drop into kdb and type "summary", it prints out a line that says this:

ccversion CCVERSION

...and I don't mean that it actually prints out the version of the C compiler. It literally prints out the string "CCVERSION".

Quoted 8 lines

The version of the C Compiler is already printed at boot up and it doesn't seem useful to replicate this in kdb. Let's just delete it. We can also delete the bit of the Makefile that called the C compiler in an attempt to pass this into kdb. This will remove one extra call to the C compiler at Makefile parse time and (very slightly) speed up builds.

I know you add lots of Cc: lines
when you pick up patches, but I think
your script can be improved.

You added "Cc: Douglas Anderson <[email protected]>", but Douglas is the author.
I think the author should be excluded from Cc.

This commit looks as follows in linux-next:

commit 685dc1264544c947d26963dcf1ac982d3408f444

Author: Douglas Anderson <[email protected]>
Date:   Wed Apr 10 11:02:35 2019 +1000

kdb: det rid of broken attempt to print CCVERSION in kdb summary

If you drop into kdb and type "summary", it prints out a line that says this:

ccversion CCVERSION

...and I don't mean that it actually prints out the version of the C compiler. It literally prints out the string "CCVERSION".

The version of the C Compiler is already printed at boot up and it doesn't seem useful to replicate this in kdb. Let's just delete it. We can also delete the bit of the Makefile that called the C compiler in an attempt to pass this into kdb. This will remove one extra call to the C compiler at Makefile parse time and (very slightly) speed up builds.

Cc Douglas Anderson <[email protected]>
Cc Jason Wessel <[email protected]>
Cc Christophe Leroy <[email protected]>
Cc "Peter Zijlstra (Intel)" <[email protected]>
Cc Kees Cook <[email protected]>
Cc Johannes Weiner <[email protected]>
Cc "Gustavo A. R. Silva" <[email protected]>
Cc Nicholas Mc Guire <[email protected]>,
Quoted 33 lines

---

 kernel/debug/kdb/Makefile   | 1 -
 kernel/debug/kdb/kdb_main.c | 1 -
 2 files changed, 2 deletions(-)
kernel/debug/kdb/Makefile +0 -1
index d4fc58f4b88d..efac857c5511 100644
@@ -6,7 +6,6 @@
 # Copyright (c) 2009 Wind River Systems, Inc. All Rights Reserved.
 #
 
-CCVERSION      := $(shell $(CC) -v 2>&1 | sed -ne '$$p')
 obj-y := kdb_io.o kdb_main.o kdb_support.o kdb_bt.o gen-kdb_cmds.o kdb_bp.o kdb_debugger.o
 obj-$(CONFIG_KDB_KEYBOARD)    += kdb_keyboard.o
 
kernel/debug/kdb/kdb_main.c +0 -2
index 82a3b32a7cfc..fc96dbf8d9de 100644
@@ -2522,7 +2522,6 @@ static int kdb_summary(int argc, const char **argv)
        kdb_printf("machine    %s\n", init_uts_ns.name.machine);
        kdb_printf("nodename   %s\n", init_uts_ns.name.nodename);
        kdb_printf("domainname %s\n", init_uts_ns.name.domainname);
-       kdb_printf("ccversion  %s\n", __stringify(CCVERSION));
 
        now = __ktime_get_real_seconds();
        time64_to_tm(now, 0, &tm);
--

2.21.0.392.gf8f6787159e-goog

Signature · 2 lines
Best Regards
Masahiro Yamada
Tested-by fred
#3 lore raw
Quoted 20 lines · On Thu, 11 Apr 2019 18:06:23 +0900 Masahiro Yamada…
Quoted 9 lines · Douglas Anderson

If you drop into kdb and type "summary", it prints out a line that says this:

ccversion CCVERSION

...and I don't mean that it actually prints out the version of the C compiler. It literally prints out the string "CCVERSION".

Quoted 8 lines

The version of the C Compiler is already printed at boot up and it doesn't seem useful to replicate this in kdb. Let's just delete it. We can also delete the bit of the Makefile that called the C compiler in an attempt to pass this into kdb. This will remove one extra call to the C compiler at Makefile parse time and (very slightly) speed up builds.

Quoted 7 lines

I know you add lots of Cc: lines
when you pick up patches, but I think
your script can be improved.

You added "Cc: Douglas Anderson <[email protected]>", but Douglas is the author.
I think the author should be excluded from Cc.

Whoops.

It's pretty benign: Doug will still only get a single email.

checkpatch checks for duplicates cc's but I think it assumes that things like

Reported-by fred
Tested-by fred

were intentional.

It would perhaps be better for checkpatch to special-case the "Cc:
fred" tag and report a duplicated Cc: if fred was also mentioned in any other tag.

#4 lore raw

Hi Andrew,

Quoted 39 lines · Andrew Morton
Quoted 20 lines · On Thu, 11 Apr 2019 18:06:23 +0900 Masahiro Yamada…
Quoted 9 lines · Douglas Anderson

If you drop into kdb and type "summary", it prints out a line that says this:

ccversion CCVERSION

...and I don't mean that it actually prints out the version of the C compiler. It literally prints out the string "CCVERSION".

Quoted 8 lines

The version of the C Compiler is already printed at boot up and it doesn't seem useful to replicate this in kdb. Let's just delete it. We can also delete the bit of the Makefile that called the C compiler in an attempt to pass this into kdb. This will remove one extra call to the C compiler at Makefile parse time and (very slightly) speed up builds.

Quoted 7 lines

I know you add lots of Cc: lines
when you pick up patches, but I think
your script can be improved.

You added "Cc: Douglas Anderson <[email protected]>", but Douglas is the author.
I think the author should be excluded from Cc.

Whoops.

It's pretty benign: Doug will still only get a single email.

checkpatch checks for duplicates cc's but I think it assumes that things like

Quoted 8 lines
Reported-by fred
Tested-by fred

were intentional.

It would perhaps be better for checkpatch to special-case the "Cc:
fred" tag and report a duplicated Cc: if fred was also mentioned in any other tag.

Sorry, I do not understand what you mean.

Douglas did not add any Cc: tag at all
in his original patch:
https://lore.kernel.org/patchwork/patch/1053953/

It's you who added the Cc: tags
(and I am guessing you did it by scripting.)

Why is this topic related to checkpatch?

Signature · 2 lines
Best Regards
Masahiro Yamada
#5 lore raw
Quoted 23 lines · On Wed, 17 Apr 2019 15:37:49 +0900 Masahiro Yamada…
Quoted 6 lines

It's pretty benign: Doug will still only get a single email.

checkpatch checks for duplicates cc's but I think it assumes that things like

Quoted 8 lines
Reported-by fred
Tested-by fred

were intentional.

It would perhaps be better for checkpatch to special-case the "Cc:
fred" tag and report a duplicated Cc: if fred was also mentioned in any other tag.

Sorry, I do not understand what you mean.

Douglas did not add any Cc: tag at all
in his original patch:
https://lore.kernel.org/patchwork/patch/1053953/

Quoted 4 lines

It's you who added the Cc: tags
(and I am guessing you did it by scripting.)

Why is this topic related to checkpatch?

Because I regularly check all patches with checkpatch but checkpatch failed to detect that I had

...
Cc: Douglas Anderson <[email protected]>

and I believe that checkpatch could and should have warned about this situation.

#6 lore raw

Hi Joe,

Can you detect redundant Cc: by checkpatch?

Please see below in details.
Thanks.

Quoted 41 lines · Andrew Morton
Quoted 23 lines · On Wed, 17 Apr 2019 15:37:49 +0900 Masahiro Yamada…
Quoted 6 lines

It's pretty benign: Doug will still only get a single email.

checkpatch checks for duplicates cc's but I think it assumes that things like

Quoted 8 lines
Reported-by fred
Tested-by fred

were intentional.

It would perhaps be better for checkpatch to special-case the "Cc:
fred" tag and report a duplicated Cc: if fred was also mentioned in any other tag.

Sorry, I do not understand what you mean.

Douglas did not add any Cc: tag at all
in his original patch:
https://lore.kernel.org/patchwork/patch/1053953/

Quoted 4 lines

It's you who added the Cc: tags
(and I am guessing you did it by scripting.)

Why is this topic related to checkpatch?

Because I regularly check all patches with checkpatch but checkpatch failed to detect that I had

...
Cc: Douglas Anderson <[email protected]>

and I believe that checkpatch could and should have warned about this situation.

Signature · 2 lines
Best Regards
Masahiro Yamada
maintainer
#7 lore raw
Quoted 6 lines · Masahiro Yamada

Hi Joe,

Can you detect redundant Cc: by checkpatch?

Please see below in details.
Thanks.

Yes, but I'm not sure why it's useful or necessary.
git send-email using some scripts elides duplicate email addresses

---
 scripts/checkpatch.pl | 13 +++++++++++++
 1 file changed, 13 insertions(+)
scripts/checkpatch.pl +13 -0
index 1c421ac42b07..bedec83cb797 100755
@@ -2688,6 +2688,19 @@ sub process {
 				$signatures{$sig_nospace} = 1;
 			}
 
+# Check for a cc: line with another signature -by: by the same author
+			if ($sig_nospace =~ /^cc:/) {
+				my $sig_email = substr($sig_nospace, 3);
+				foreach my $sig (sort keys %signatures) {
+					next if ($sig =~ /^cc:/);
+					$sig =~ s/^[^:]+://;
+					if ($sig eq $sig_email) {
+						WARN("BAD_SIGN_OFF",
+						     "Unnecessary CC: as there is another signature with the same name/email address\n" . $herecurr);
+					}
+				}
+			}
+
 # Check Co-developed-by: immediately followed by Signed-off-by: with same name and email
 			if ($sign_off =~ /^co-developed-by:$/i) {
 				if ($email eq $author) {
#8 lore raw
Quoted 10 lines · On Fri, 19 Apr 2019 04:14:27 -0700 Joe Perches <[email protected]> wrote:
Quoted 6 lines · Masahiro Yamada

Hi Joe,

Can you detect redundant Cc: by checkpatch?

Please see below in details.
Thanks.

Yes, but I'm not sure why it's useful or necessary.
git send-email using some scripts elides duplicate email addresses

Other (all?) MUAs will avoid addressing an email to a recipient more than once. The issue here is redundant Cc: lines in the changelog.

Quoted 12 lines
scripts/checkpatch.pl +6 -0
@@ -2688,6 +2688,19 @@ sub process {
 				$signatures{$sig_nospace} = 1;
 			}
 
+# Check for a cc: line with another signature -by: by the same author
+			if ($sig_nospace =~ /^cc:/) {
+				my $sig_email = substr($sig_nospace, 3);
+				foreach my $sig (sort keys %signatures) {
+					next if ($sig =~ /^cc:/);
+					$sig =~ s/^[^:]+://;

scripts/checkpatch.pl sub process { · line 2706

Quoted 10 lines
scripts/checkpatch.pl +7 -0
+					if ($sig eq $sig_email) {
+						WARN("BAD_SIGN_OFF",
+						     "Unnecessary CC: as there is another signature with the same name/email address\n" . $herecurr);
+					}
+				}
+			}
+
 # Check Co-developed-by: immediately followed by Signed-off-by: with same name and email
 			if ($sign_off =~ /^co-developed-by:$/i) {
 				if ($email eq $author) {

Thanks. But my checkpatch.pl is different from yours.

q:/usr/src/25> grep "immediately followed by" scripts/checkpatch.pl q:/usr/src/25>

maintainer
#9 lore raw
Quoted 3 lines · Andrew Morton
Quoted 2 lines · On Fri, 19 Apr 2019 04:14:27 -0700 Joe Perches <[email protected]> wrote:
Quoted 1 line · Masahiro Yamada

Can you detect redundant Cc: by checkpatch?

[]

Quoted 1 line
Quoted 1 line

I'm not sure why it's useful or necessary.

[]

Quoted 1 line

The issue here is redundant Cc: lines in the changelog.

CC entries have very little actual value in a changelog anyway.
Quoted 1 line
Quoted 1 line

--- a/scripts/checkpatch.pl

[]

Quoted 23 lines
Quoted 10 lines
scripts/checkpatch.pl +6 -0
@@ -2688,6 +2688,19 @@ sub process {
 				$signatures{$sig_nospace} = 1;
 			}
 
+# Check for a cc: line with another signature -by: by the same author
+			if ($sig_nospace =~ /^cc:/) {
+				my $sig_email = substr($sig_nospace, 3);
+				foreach my $sig (sort keys %signatures) {
+					next if ($sig =~ /^cc:/);
+					$sig =~ s/^[^:]+://;

scripts/checkpatch.pl sub process { · line 2706

Quoted 10 lines
scripts/checkpatch.pl +7 -0
+					if ($sig eq $sig_email) {
+						WARN("BAD_SIGN_OFF",
+						     "Unnecessary CC: as there is another signature with the same name/email address\n" . $herecurr);
+					}
+				}
+			}
+
 # Check Co-developed-by: immediately followed by Signed-off-by: with same name and email
 			if ($sign_off =~ /^co-developed-by:$/i) {
 				if ($email eq $author) {

Thanks. But my checkpatch.pl is different from yours.

Quoted 2 lines

q:/usr/src/25> grep "immediately followed by" scripts/checkpatch.pl q:/usr/src/25>

I almost always write patches against -next

$ git grep "immediately followed by" next-20190418 -- scripts/checkpatch.pl
next-20190418:scripts/checkpatch.pl:# Check Co-developed-by: immediately followed by Signed-off-by: with same name and email
next-20190418:scripts/checkpatch.pl:                                             "Co-developed-by: must be immediately followed by Signed-off-by:\n" . "$here\n" . $rawline);
next-20190418:scripts/checkpatch.pl:                                         "Co-developed-by: must be immediately followed by Signed-off-by:\n" . "$here\n" . $rawline . "\n" .$rawlines[$linenr]);

You seem to be missing

commit 6c5d24eef7be7adfcb608f2852ab69b58935133b

Author: Sean Christopherson <[email protected]>
Date:   Fri Mar 22 14:11:37 2019 -0700

checkpatch: Warn on improper usage of Co-developed-by

The purpose of Co-developed-by: is to give attribution to authors who aren't already attributed by the From: tag, i.e. who aren't the nominal patch author. Because Co-developed-by: is essentially a variation of From:, it must be accompanied by a Signed-off-by: of the associated co-author. To ease the burden of determining whether or not co-authors have signed off, Co-developed-by and Signed-off-by: must be explicitly paired, i.e. on consecutive lines for a given co-author.

Reviewed-by
#10 lore raw
In reply to Joe Perches

This patch is technically super easy, but shows how difficult to apply a single patch in a correct manner.

The following showed up in today's linux-next, doubling
"Signed-off-by: Douglas Anderson <[email protected]>"

This is obviously caused by the committer.

Do we need some check script for maintainers before "git push" ?

commit 51fee3389d71bfd281df02c55546a6103779e145

Author:     Douglas Anderson <[email protected]>
AuthorDate: Fri Mar 22 18:52:27 2019 -0700
Commit:     Daniel Thompson <[email protected]>
CommitDate: Thu May 2 14:55:07 2019 +0100

kdb: Get rid of broken attempt to print CCVERSION in kdb summary

If you drop into kdb and type "summary", it prints out a line that says this:

ccversion CCVERSION

...and I don't mean that it actually prints out the version of the C compiler. It literally prints out the string "CCVERSION".

The version of the C Compiler is already printed at boot up and it doesn't seem useful to replicate this in kdb. Let's just delete it. We can also delete the bit of the Makefile that called the C compiler in an attempt to pass this into kdb. This will remove one extra call to the C compiler at Makefile parse time and (very slightly) speed up builds.

Quoted 41 lines · Joe Perches
Quoted 6 lines · Masahiro Yamada

Hi Joe,

Can you detect redundant Cc: by checkpatch?

Please see below in details.
Thanks.

Yes, but I'm not sure why it's useful or necessary.
git send-email using some scripts elides duplicate email addresses

---
 scripts/checkpatch.pl | 13 +++++++++++++
 1 file changed, 13 insertions(+)
scripts/checkpatch.pl +13 -0
index 1c421ac42b07..bedec83cb797 100755
@@ -2688,6 +2688,19 @@ sub process {
                                $signatures{$sig_nospace} = 1;
                        }
 
+# Check for a cc: line with another signature -by: by the same author
+                       if ($sig_nospace =~ /^cc:/) {
+                               my $sig_email = substr($sig_nospace, 3);
+                               foreach my $sig (sort keys %signatures) {
+                                       next if ($sig =~ /^cc:/);
+                                       $sig =~ s/^[^:]+://;
+                                       if ($sig eq $sig_email) {
+                                               WARN("BAD_SIGN_OFF",
+                                                    "Unnecessary CC: as there is another signature with the same name/email address\n" . $herecurr);
+                                       }
+                               }
+                       }
+
 # Check Co-developed-by: immediately followed by Signed-off-by: with same name and email
                        if ($sign_off =~ /^co-developed-by:$/i) {
                                if ($email eq $author) {
Signature · 2 lines
Best Regards
Masahiro Yamada
#11 lore raw
Quoted 10 lines · Masahiro Yamada

This patch is technically super easy, but shows how difficult to apply a single patch in a correct manner.

The following showed up in today's linux-next, doubling
"Signed-off-by: Douglas Anderson <[email protected]>"

This is obviously caused by the committer.

Quite so. Thanks for pointing it out.

Quoted 2 lines

Do we need some check script for maintainers before "git push" ?

I have to admit that I think this was just a checkpatch mistake on my part.

This thread is a bit unusual in that patchwork has collected up all the example Tested-by: Fred stuff that arose during the earlier tools conversation. It looks like I was sufficiently distracted by those to overlook the duplicated sign off...

Daniel.

Quoted 82 lines

commit 51fee3389d71bfd281df02c55546a6103779e145

Author:     Douglas Anderson <[email protected]>
AuthorDate: Fri Mar 22 18:52:27 2019 -0700
Commit:     Daniel Thompson <[email protected]>
CommitDate: Thu May 2 14:55:07 2019 +0100

kdb: Get rid of broken attempt to print CCVERSION in kdb summary

If you drop into kdb and type "summary", it prints out a line that says this:

ccversion CCVERSION

...and I don't mean that it actually prints out the version of the C compiler. It literally prints out the string "CCVERSION".

The version of the C Compiler is already printed at boot up and it doesn't seem useful to replicate this in kdb. Let's just delete it. We can also delete the bit of the Makefile that called the C compiler in an attempt to pass this into kdb. This will remove one extra call to the C compiler at Makefile parse time and (very slightly) speed up builds.

Quoted 41 lines · Joe Perches
Quoted 6 lines · Masahiro Yamada

Hi Joe,

Can you detect redundant Cc: by checkpatch?

Please see below in details.
Thanks.

Yes, but I'm not sure why it's useful or necessary.
git send-email using some scripts elides duplicate email addresses

---
 scripts/checkpatch.pl | 13 +++++++++++++
 1 file changed, 13 insertions(+)
scripts/checkpatch.pl +13 -0
index 1c421ac42b07..bedec83cb797 100755
@@ -2688,6 +2688,19 @@ sub process {
                                $signatures{$sig_nospace} = 1;
                        }
 
+# Check for a cc: line with another signature -by: by the same author
+                       if ($sig_nospace =~ /^cc:/) {
+                               my $sig_email = substr($sig_nospace, 3);
+                               foreach my $sig (sort keys %signatures) {
+                                       next if ($sig =~ /^cc:/);
+                                       $sig =~ s/^[^:]+://;
+                                       if ($sig eq $sig_email) {
+                                               WARN("BAD_SIGN_OFF",
+                                                    "Unnecessary CC: as there is another signature with the same name/email address\n" . $herecurr);
+                                       }
+                               }
+                       }
+
 # Check Co-developed-by: immediately followed by Signed-off-by: with same name and email
                        if ($sign_off =~ /^co-developed-by:$/i) {
                                if ($email eq $author) {
Signature · 2 lines
Best Regards
Masahiro Yamada