checkpatch: GIT_COMMIT_ID: handle commit messages with multiple quotes
PATCH 1/1 checkpatch: GIT_COMMIT_ID: handle commit messages with multiple quotes
Commits which mentioned/referenced "revert commits" in their description will get error even if they follow the proper syntax.
for reference:
commit e8a170ff9a35 ("drm/amdgpu: enable -msse2 for GCC 7.1+ users")
This patch checks for quotes inside the commit message and adds it to $orig_desc.
Earlier, the script just won't update in case of such commit message. I modified old condition and added new conditions to check possible patterns.
Following patters are solved (commit taken as example):
- commit 193392ed9f69 ("Revert "drm/amd/display: add -msse2 to prevent Clang from emitting libcalls to undefined SW FP routines"")
- commit 193392ed9f69 ("Revert
"drm/amd/display: add -msse2 to prevent Clang from emitting libcalls to undefined SW FP routines"")
- commit 193392ed9f69 ("Revert "drm/amd/display:
add -msse2 to prevent Clang from emitting libcalls to undefined SW FP routines"")
- commit 193392ed9f69
("Revert "drm/amd/display: add -msse2 to prevent Clang from emitting libcalls to undefined SW FP routines"")
--- scripts/checkpatch.pl | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-)
scripts/checkpatch.pl +26 -6
@@ -2862,23 +2862,42 @@ sub process { $orig_desc = $1; $hasparens = 1; } elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s*$/i && - defined $rawlines[$linenr] && - $rawlines[$linenr] =~ /^\s*\("([^"]+)"\)/) { + defined $rawlines[$linenr]) { + if ($rawlines[$linenr] =~ /^\s*\("([^"]+)"\)/) { + $orig_desc = $1; + $hasparens = 1; + } elsif ($rawlines[$linenr] =~ /^\s*\("([^"]+"[^"]+[^"]")"\)/) { + $orig_desc = $1; + $hasparens = 1; + } + } elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("[^"]+$/i && + defined $rawlines[$linenr]) { + $line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("([^"]+)$/i; $orig_desc = $1; + if($rawlines[$linenr] =~ /^\s*[^"]+"\)/) { + $rawlines[$linenr] =~ /^\s*([^"]+)"\)/; + $orig_desc .= " " . $1; $hasparens = 1; - } elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("[^"]+$/i && + } elsif ($rawlines[$linenr] =~ /^\s*"[^"]+""\)/) { + $rawlines[$linenr] =~ /^\s*("[^"]+")"\)/; + $orig_desc .= " " . $1; + $hasparens = 1; + } + } elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("([^"]+"[^"]+[^"]")"\)/i) { + $orig_desc = $1; + $hasparens = 1; + } elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("[^"]+"[^"]+$/i && defined $rawlines[$linenr] && - $rawlines[$linenr] =~ /^\s*[^"]+"\)/) { - $line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("([^"]+)$/i; + $rawlines[$linenr] =~ /^\s*[^"]+""\)/) { + $line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("([^"]+"[^"]+)$/i; $orig_desc = $1; - $rawlines[$linenr] =~ /^\s*([^"]+)"\)/; + $rawlines[$linenr] =~ /^\s*([^"]+")"\)/; $orig_desc .= " " . $1; $hasparens = 1; } ($id, $description) = git_commit_info($orig_commit, $id, $orig_desc); if (defined($id) && ($short || $long || $space || $case || ($orig_desc ne $description) || !$hasparens)) {
ERROR("GIT_COMMIT_ID",
Signature · 6 lines
2.28.0 _______________________________________________ Linux-kernel-mentees mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
Joe Perches
maintainerQuoted 2 lines · Ayush
Commits which mentioned/referenced "revert commits" in their description will get error even if they follow the proper syntax.
I think all your examples are broken.
I think all should start with revert
i.e.: Reverts commit <SHA-1> ("description...")
Quoted 81 lines
for reference:
commite8a170ff9a35("drm/amdgpu: enable -msse2 for GCC 7.1+ users")This patch checks for quotes inside the commit message and adds it to $orig_desc.
Earlier, the script just won't update in case of such commit message. I modified old condition and added new conditions to check possible patterns.
Following patters are solved (commit taken as example):
- commit193392ed9f69("Revert "drm/amd/display: add -msse2 to prevent Clang from emitting libcalls to undefined SW FP routines"")- commit
193392ed9f69("Revert
"drm/amd/display: add -msse2 to prevent Clang from emitting libcalls to undefined SW FP routines"")- commit
193392ed9f69("Revert "drm/amd/display:
add -msse2 to prevent Clang from emitting libcalls to undefined SW FP routines"")- commit
193392ed9f69
("Revert "drm/amd/display: add -msse2 to prevent Clang from emitting libcalls to undefined SW FP routines"")Signed-off-by Ayush <[email protected]>--- scripts/checkpatch.pl | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-)scripts/checkpatch.pl +26
-6@@ -2862,23 +2862,42 @@ sub process { $orig_desc = $1; $hasparens = 1; } elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s*$/i && - defined $rawlines[$linenr] && - $rawlines[$linenr] =~ /^\s*\("([^"]+)"\)/) { + defined $rawlines[$linenr]) { + if ($rawlines[$linenr] =~ /^\s*\("([^"]+)"\)/) { + $orig_desc = $1; + $hasparens = 1; + } elsif ($rawlines[$linenr] =~ /^\s*\("([^"]+"[^"]+[^"]")"\)/) { + $orig_desc = $1; + $hasparens = 1; + } + } elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("[^"]+$/i && + defined $rawlines[$linenr]) { + $line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("([^"]+)$/i; $orig_desc = $1; + if($rawlines[$linenr] =~ /^\s*[^"]+"\)/) { + $rawlines[$linenr] =~ /^\s*([^"]+)"\)/; + $orig_desc .= " " . $1; $hasparens = 1; - } elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("[^"]+$/i && + } elsif ($rawlines[$linenr] =~ /^\s*"[^"]+""\)/) { + $rawlines[$linenr] =~ /^\s*("[^"]+")"\)/; + $orig_desc .= " " . $1; + $hasparens = 1; + } + } elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("([^"]+"[^"]+[^"]")"\)/i) { + $orig_desc = $1; + $hasparens = 1; + } elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("[^"]+"[^"]+$/i && defined $rawlines[$linenr] && - $rawlines[$linenr] =~ /^\s*[^"]+"\)/) { - $line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("([^"]+)$/i; + $rawlines[$linenr] =~ /^\s*[^"]+""\)/) { + $line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("([^"]+"[^"]+)$/i; $orig_desc = $1; - $rawlines[$linenr] =~ /^\s*([^"]+)"\)/; + $rawlines[$linenr] =~ /^\s*([^"]+")"\)/; $orig_desc .= " " . $1; $hasparens = 1; } ($id, $description) = git_commit_info($orig_commit, $id, $orig_desc); if (defined($id) && ($short || $long || $space || $case || ($orig_desc ne $description) || !$hasparens)) { ERROR("GIT_COMMIT_ID",
Quoted 4 lines
I think all your examples are broken.
I think all should start with revert
i.e.: Reverts commit <SHA-1> ("description...")
Actually I am talking about those commits which referenced a revert commit.
For example:
If I want to mention a revert commit in my commit message, I will do something like.
This bug appeared first in commit 1234567890ab ("Revert "abc: foo bar""). (Just an example)
Here, according to syntax, it is right but checkpatch.pl gives an error as multiple quotes in commit messages are not handled in checkpatch.pl.
Regards,
Ayush
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
Quoted 9 lines · Ayush
Quoted 4 lines
I think all your examples are broken.
I think all should start with revert
i.e.: Reverts commit <SHA-1> ("description...")Actually I am talking about those commits which referenced a revert commit.
For example:
Quoted 8 lines
If I want to mention a revert commit in my commit message, I will do something like.
This bug appeared first in commit
1234567890ab("Revert "abc: foo bar""). (Just an example)Here, according to syntax, it is right but checkpatch.pl gives an error as multiple quotes in commit messages are not handled in checkpatch.pl.
As the mentor in the linux kernel community bridge program, I usually inform the mentees when the review on the mentee mailing list has successfully concluded to a first acceptable state and I think it is well advised to reach out to the maintainers for further discussion.
You did not do that, but just send some patch to the maintainers. That is fully up to you, but I will not support the patch acceptance in any way, and it suggests that you do not see the need to be mentored.
If you can land patches without mentoring support successfully, that is great, but then you do not need a mentorship.
Now, to the commit:
Ayush, your commit message is largely incomprehensible.
Your follow-up explanation that was needed should have been in the commit message in the first place.
Ayush, you did not sign-off with your full legal name.
So, I advice NOT TO TAKE this patch.
I did not even start testing and reviewing the code yet.
Lukas
Sir,
Quoted 11 lines
As the mentor in the linux kernel community bridge program, I usually inform the mentees when the review on the mentee mailing list has successfully concluded to a first acceptable state and I think it is well advised to reach out to the maintainers for further discussion.
You did not do that, but just send some patch to the maintainers. That is fully up to you, but I will not support the patch acceptance in any way, and it suggests that you do not see the need to be mentored.
If you can land patches without mentoring support successfully, that is great, but then you do not need a mentorship.
I am extremely sorry for my mistakes. It won't happen again.
Quoted 6 lines
Now, to the commit:
Ayush, your commit message is largely incomprehensible.
Your follow-up explanation that was needed should have been in the commit message in the first place.
It was my first patch, so I had very little idea of forming commit messages. I will discuss it with mentors next time before sending the patch next time.
Quoted 1 line
Ayush, you did not sign-off with your full legal name.
My legal name according to all official identification documents of India is Ayush.
I have no surname registered legally.
So should I include "Ayush <[email protected]>" or do I need to include my last name too (Which is Ayush only)?
Please accept my apology.
Thanks,
Ayush
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
dropped the maintainers.
Quoted 18 lines · Ayush
Sir,
Quoted 11 lines
As the mentor in the linux kernel community bridge program, I usually inform the mentees when the review on the mentee mailing list has successfully concluded to a first acceptable state and I think it is well advised to reach out to the maintainers for further discussion.
You did not do that, but just send some patch to the maintainers. That is fully up to you, but I will not support the patch acceptance in any way, and it suggests that you do not see the need to be mentored.
If you can land patches without mentoring support successfully, that is great, but then you do not need a mentorship.
I am extremely sorry for my mistakes. It won't happen again.
Quoted 2 lines
Now, to the commit:
Quoted 8 lines
Quoted 4 lines
Ayush, your commit message is largely incomprehensible.
Your follow-up explanation that was needed should have been in the commit message in the first place.
It was my first patch, so I had very little idea of forming commit messages. I will discuss it with mentors next time before sending the patch next time.
Let us start with the simpler patch and then see if you can write a commit message that convinces Joe to ack your patch.
Quoted 6 lines
Quoted 1 line
Ayush, you did not sign-off with your full legal name.
My legal name according to all official identification documents of India is Ayush.
I have no surname registered legally.
So should I include "Ayush <[email protected]>" or do I need to include my last name too (Which is Ayush only)?
Okay. If you say so, I cannot judge but you should try to use a name that others can with a fair chance uniquely identify that is you.
The name is used in git log summaries, pull requests, etc.; so, it should be a name that with high chance to refer to one person.
Maybe you find a good way that works as suitable name for unique identification?
Lukas
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
Joe Perches
maintainerQuoted 41 lines · Lukas Bulwahn
dropped the maintainers.
Quoted 18 lines · Ayush
Sir,
Quoted 11 lines
As the mentor in the linux kernel community bridge program, I usually inform the mentees when the review on the mentee mailing list has successfully concluded to a first acceptable state and I think it is well advised to reach out to the maintainers for further discussion.
You did not do that, but just send some patch to the maintainers. That is fully up to you, but I will not support the patch acceptance in any way, and it suggests that you do not see the need to be mentored.
If you can land patches without mentoring support successfully, that is great, but then you do not need a mentorship.
I am extremely sorry for my mistakes. It won't happen again.
Quoted 2 lines
Now, to the commit:
Quoted 8 lines
Quoted 4 lines
Ayush, your commit message is largely incomprehensible.
Your follow-up explanation that was needed should have been in the commit message in the first place.
It was my first patch, so I had very little idea of forming commit messages. I will discuss it with mentors next time before sending the patch next time.
Let us start with the simpler patch and then see if you can write a commit message that convinces Joe to ack your patch.
Quoted 6 lines
Quoted 1 line
Ayush, you did not sign-off with your full legal name.
My legal name according to all official identification documents of India is Ayush.
I have no surname registered legally.
So should I include "Ayush <[email protected]>" or do I need to include my last name too (Which is Ayush only)?
Quoted 8 lines
Okay. If you say so, I cannot judge but you should try to use a name that others can with a fair chance uniquely identify that is you.
The name is used in git log summaries, pull requests, etc.; so, it should be a name that with high chance to refer to one person.
Maybe you find a good way that works as suitable name for unique identification?
I believe the Developer's Certificate of Origin (DCO) in Documentation/process/submitting-patches.rst just asks
for a "full name".
If Ayush has no surname, then I imagine that his actual full name Ayush should be good enough for the DCO.
A line like "Signed-off-by: Ayush <[email protected]>" should be fine.
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
Quoted 56 lines · Joe Perches
Quoted 41 lines · Lukas Bulwahn
dropped the maintainers.
Quoted 18 lines · Ayush
Sir,
Quoted 11 lines
As the mentor in the linux kernel community bridge program, I usually inform the mentees when the review on the mentee mailing list has successfully concluded to a first acceptable state and I think it is well advised to reach out to the maintainers for further discussion.
You did not do that, but just send some patch to the maintainers. That is fully up to you, but I will not support the patch acceptance in any way, and it suggests that you do not see the need to be mentored.
If you can land patches without mentoring support successfully, that is great, but then you do not need a mentorship.
I am extremely sorry for my mistakes. It won't happen again.
Quoted 2 lines
Now, to the commit:
Quoted 8 lines
Quoted 4 lines
Ayush, your commit message is largely incomprehensible.
Your follow-up explanation that was needed should have been in the commit message in the first place.
It was my first patch, so I had very little idea of forming commit messages. I will discuss it with mentors next time before sending the patch next time.
Let us start with the simpler patch and then see if you can write a commit message that convinces Joe to ack your patch.
Quoted 6 lines
Quoted 1 line
Ayush, you did not sign-off with your full legal name.
My legal name according to all official identification documents of India is Ayush.
I have no surname registered legally.
So should I include "Ayush <[email protected]>" or do I need to include my last name too (Which is Ayush only)?Quoted 8 lines
Okay. If you say so, I cannot judge but you should try to use a name that others can with a fair chance uniquely identify that is you.
The name is used in git log summaries, pull requests, etc.; so, it should be a name that with high chance to refer to one person.
Maybe you find a good way that works as suitable name for unique identification?
I believe the Developer's Certificate of Origin (DCO) in
Documentation/process/submitting-patches.rstjust asks
for a "full name".
Quoted 6 lines
If Ayush has no surname, then I imagine that his actual full name Ayush should be good enough for the DCO.
A line like "Signed-off-by: Ayush <[email protected]>" should be fine.
Agree. Let us, Ayush and me, focus on getting some patches technically ready for your review, Joe, and with that, continue to improve checkpatch.pl.
Lukas
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees