checkpatch: add fix option for MISSING_SIGN_OFF
PATCH 1/1 checkpatch: add fix option for MISSING_SIGN_OFF
Currently checkpatch warns us if there is no 'Signed-off-by' line for the patch.
E.g., running checkpatch on commit f68e7927212f ("Revert "powerpc/book3s32: Reorder _PAGE_XXX flags to simplify TLB handling"") reports this error:
ERROR: Missing Signed-off-by: line(s)
Provide a fix by adding a Signed-off-by line corresponding to the author of the patch before the start of diff(s)
--- scripts/checkpatch.pl | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
scripts/checkpatch.pl +10 -2
@@ -2404,6 +2404,7 @@ sub process { my $last_blank_line = 0; my $last_coalesced_string_linenr = -1; + my $diff_linenr = 0; our @report = (); our $cnt_lines = 0;
@@ -2602,6 +2603,10 @@ sub process { $realfile =~ s@^([^/]*)/@@ if (!$file); $in_commit_log = 0; $found_file = 1; + # to add missing sign off line before diff(s) + if($diff_linenr == 0) { + $diff_linenr = $fixlinenr; + } } elsif ($line =~ /^\+\+\+\s+(\S+)/) { $realfile = $1; $realfile =~ s@^([^/]*)/@@ if (!$file);
@@ -7119,8 +7124,11 @@ sub process { } if ($is_patch && $has_commit_log && $chk_signoff) { if ($signoff == 0) { - ERROR("MISSING_SIGN_OFF", - "Missing Signed-off-by: line(s)\n"); + if (ERROR("MISSING_SIGN_OFF", + "Missing Signed-off-by: line(s)\n") && + $fix) { + fix_insert_line($diff_linenr, "Signed-off-by: $author\n"); + } } elsif ($authorsignoff != 1) { # authorsignoff values: # 0 -> missing sign off
Signature · 6 lines
2.17.1 _______________________________________________ Linux-kernel-mentees mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
Quoted 46 lines · Aditya Srivastava
Currently checkpatch warns us if there is no 'Signed-off-by' line for the patch.
E.g., running checkpatch on commit
f68e7927212f("Revert "powerpc/book3s32: Reorder_PAGE_XXXflags to simplify TLB handling"") reports this error:ERROR: Missing Signed-off-by: line(s)
Provide a fix by adding a Signed-off-by line corresponding to the author of the patch before the start of diff(s)
Suggested-by Joe Perches <[email protected]>Signed-off-by Aditya Srivastava <[email protected]>--- scripts/checkpatch.pl | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)scripts/checkpatch.pl +5
-0@@ -2404,6 +2404,7 @@ sub process { my $last_blank_line = 0; my $last_coalesced_string_linenr = -1; + my $diff_linenr = 0; our @report = (); our $cnt_lines = 0;@@ -2602,6 +2603,10 @@ sub process { $realfile =~ s@^([^/]*)/@@ if (!$file); $in_commit_log = 0; $found_file = 1; + # to add missing sign off line before diff(s) + if($diff_linenr == 0) { + $diff_linenr = $fixlinenr; + } } elsif ($line =~ /^\+\+\+\s+(\S+)/) { $realfile = $1; $realfile =~ s@^([^/]*)/@@ if (!$file);@@ -7119,8 +7124,11 @@ sub process { } if ($is_patch && $has_commit_log && $chk_signoff) { if ($signoff == 0) {
scripts/checkpatch.pl sub process { · line 7134
Quoted 10 lines
scripts/checkpatch.pl +5
-2- ERROR("MISSING_SIGN_OFF", - "Missing Signed-off-by: line(s)\n"); + if (ERROR("MISSING_SIGN_OFF", + "Missing Signed-off-by: line(s)\n") && + $fix) { + fix_insert_line($diff_linenr, "Signed-off-by: $author\n"); + } } elsif ($authorsignoff != 1) { # authorsignoff values: # 0 -> missing sign off
This probably is wrong. I should add the sign-off before first patch separator(ie '---')
Will send the modified patch.
Thanks
Aditya
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
Quoted 12 lines · Aditya Srivastava
Currently checkpatch warns us if there is no 'Signed-off-by' line for the patch.
E.g., running checkpatch on commit
f68e7927212f("Revert "powerpc/book3s32: Reorder_PAGE_XXXflags to simplify TLB handling"") reports this error:ERROR: Missing Signed-off-by: line(s)
Provide a fix by adding a Signed-off-by line corresponding to the author of the patch before the start of diff(s)
Can you please provide an evaluation first?
As far as remember, the fix is often not to add a Signed-off-by: tag but it requires something completely different.
Lukas
Quoted 44 lines
Suggested-by Joe Perches <[email protected]>Signed-off-by Aditya Srivastava <[email protected]>--- scripts/checkpatch.pl | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)scripts/checkpatch.pl +10
-2@@ -2404,6 +2404,7 @@ sub process { my $last_blank_line = 0; my $last_coalesced_string_linenr = -1; + my $diff_linenr = 0; our @report = (); our $cnt_lines = 0;@@ -2602,6 +2603,10 @@ sub process { $realfile =~ s@^([^/]*)/@@ if (!$file); $in_commit_log = 0; $found_file = 1; + # to add missing sign off line before diff(s) + if($diff_linenr == 0) { + $diff_linenr = $fixlinenr; + } } elsif ($line =~ /^\+\+\+\s+(\S+)/) { $realfile = $1; $realfile =~ s@^([^/]*)/@@ if (!$file);@@ -7119,8 +7124,11 @@ sub process { } if ($is_patch && $has_commit_log && $chk_signoff) { if ($signoff == 0) { - ERROR("MISSING_SIGN_OFF", - "Missing Signed-off-by: line(s)\n"); + if (ERROR("MISSING_SIGN_OFF", + "Missing Signed-off-by: line(s)\n") && + $fix) { + fix_insert_line($diff_linenr, "Signed-off-by: $author\n"); + } } elsif ($authorsignoff != 1) { # authorsignoff values:# 0 -> missing sign off
Quoted 4 lines
--
2.17.1
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
Quoted 12 lines · Lukas Bulwahn
Quoted 9 lines · Aditya Srivastava
Currently checkpatch warns us if there is no 'Signed-off-by' line for the patch.
E.g., running checkpatch on commit
f68e7927212f("Revert "powerpc/book3s32: Reorder_PAGE_XXXflags to simplify TLB handling"") reports this error:ERROR: Missing Signed-off-by: line(s)
Quoted 9 lines
Quoted 3 lines
Provide a fix by adding a Signed-off-by line corresponding to the author of the patch before the start of diff(s)
Can you please provide an evaluation first?
As far as remember, the fix is often not to add a Signed-off-by: tag but it requires something completely different.
I have generated the 'git logs' of the commits causing MISSING_SIGN_OFF at:
https://github.com/AdityaSrivast/kernel-tasks/blob/master/Task7/summary_log.txt
Actually this fix was suggested by Joe at:
https://lore.kernel.org/linux-kernel-mentees/[email protected]/
Thanks
Aditya
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
Quoted 24 lines · Aditya
Quoted 12 lines · Lukas Bulwahn
Quoted 9 lines · Aditya Srivastava
Currently checkpatch warns us if there is no 'Signed-off-by' line for the patch.
E.g., running checkpatch on commit
f68e7927212f("Revert "powerpc/book3s32: Reorder_PAGE_XXXflags to simplify TLB handling"") reports this error:ERROR: Missing Signed-off-by: line(s)
Quoted 9 lines
Quoted 3 lines
Provide a fix by adding a Signed-off-by line corresponding to the author of the patch before the start of diff(s)
Can you please provide an evaluation first?
As far as remember, the fix is often not to add a Signed-off-by: tag but it requires something completely different.
Quoted 7 lines
I have generated the 'git logs' of the commits causing
MISSING_SIGN_OFFat:
https://github.com/AdityaSrivast/kernel-tasks/blob/master/Task7/summary_log.txtActually this fix was suggested by Joe at:
https://lore.kernel.org/linux-kernel-mentees/[email protected]/
Yes I know. Now look at the reports.
The rc and release commit tags do not get a Signed-off-by intentionally. Other than that, reverts (for reverts is probably best to explain how to do a revert... so that a sign-off-by is included) and typos.
Lukas
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
Quoted 35 lines · Lukas Bulwahn
Quoted 24 lines · Aditya
Quoted 12 lines · Lukas Bulwahn
Quoted 9 lines · Aditya Srivastava
Currently checkpatch warns us if there is no 'Signed-off-by' line for the patch.
E.g., running checkpatch on commit
f68e7927212f("Revert "powerpc/book3s32: Reorder_PAGE_XXXflags to simplify TLB handling"") reports this error:ERROR: Missing Signed-off-by: line(s)
Quoted 9 lines
Quoted 3 lines
Provide a fix by adding a Signed-off-by line corresponding to the author of the patch before the start of diff(s)
Can you please provide an evaluation first?
As far as remember, the fix is often not to add a Signed-off-by: tag but it requires something completely different.
Quoted 7 lines
I have generated the 'git logs' of the commits causing
MISSING_SIGN_OFFat:
https://github.com/AdityaSrivast/kernel-tasks/blob/master/Task7/summary_log.txtActually this fix was suggested by Joe at:
https://lore.kernel.org/linux-kernel-mentees/[email protected]/Yes I know. Now look at the reports.
Quoted 8 lines
The rc and release commit tags do not get a Signed-off-by intentionally. Other than that, reverts (for reverts is probably best to explain how to do a revert... so that a sign-off-by is included) and typos.
Lukas
Yes, I agree. But for the typos, the user must get BAD_SIGN_OFF warning for "Non-standard signature". So user will have to fix that manually. If so, this error is already avoided.
For the release commits, I think the user(s) may not use checkpatch
For the rest (ie reverts) with no sign-offs, I think that if we just add the sign off line, it serves our purpose.
Of course if we explain them to revert with sign-off, it will be probably the same outcome.
Thus, I feel that we can proceed with this fix for this class of error. What do you think/suggest?
Thanks
Aditya
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
Quoted 43 lines · Aditya
Quoted 41 lines · Lukas Bulwahn
Quoted 24 lines · Aditya
Quoted 12 lines · Lukas Bulwahn
Quoted 9 lines · Aditya Srivastava
Currently checkpatch warns us if there is no 'Signed-off-by' line for the patch.
E.g., running checkpatch on commit
f68e7927212f("Revert "powerpc/book3s32: Reorder_PAGE_XXXflags to simplify TLB handling"") reports this error:ERROR: Missing Signed-off-by: line(s)
Quoted 9 lines
Quoted 3 lines
Provide a fix by adding a Signed-off-by line corresponding to the author of the patch before the start of diff(s)
Can you please provide an evaluation first?
As far as remember, the fix is often not to add a Signed-off-by: tag but it requires something completely different.
Quoted 7 lines
I have generated the 'git logs' of the commits causing
MISSING_SIGN_OFFat:
https://github.com/AdityaSrivast/kernel-tasks/blob/master/Task7/summary_log.txtActually this fix was suggested by Joe at:
https://lore.kernel.org/linux-kernel-mentees/[email protected]/Yes I know. Now look at the reports.
The rc and release commit tags do not get a Signed-off-by intentionally. Other than that, reverts (for reverts is probably best to explain how to do a revert... so that a sign-off-by is included) and typos.
Quoted 7 lines
Quoted 2 lines
Lukas
Yes, I agree. But for the typos, the user must get
BAD_SIGN_OFFwarning for "Non-standard signature". So user will have to fix that manually. If so, this error is already avoided.
But then the fix should not be applied if there is a BAD_SIGN_OFF warning, right?
Typos can also be fixed automatically by a fuzzy match. That is a different feature, though and a different (next) patch.
Quoted 2 lines
For the release commits, I think the user(s) may not use checkpatch
Agree. You can filter those out of your evaluation.
Quoted 5 lines
For the rest (ie reverts) with no sign-offs, I think that if we just add the sign off line, it serves our purpose.
Of course if we explain them to revert with sign-off, it will be probably the same outcome.
Then do both. Provide a fix in checkpatch.pl and provide documentation.
So, how many are because of reverts and how many are because of typos?
Also, how many reverts do currently include a proper sign-off?
When the majority does not include a proper sign-off on revert commit, maybe the convention is to not have a sign-off on reverts. When we have some data on that, we can discuss this with some central maintainers in the kernel community.
If that is the case, then the fix is to change checkpatch.pl not to complain on revert commits because of a missing sign-off.
Quoted 3 lines
Thus, I feel that we can proceed with this fix for this class of error. What do you think/suggest?
Please continue on the steps above.
Lukas
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
Quoted 52 lines · Lukas Bulwahn
Quoted 43 lines · Aditya
Quoted 41 lines · Lukas Bulwahn
Quoted 24 lines · Aditya
Quoted 12 lines · Lukas Bulwahn
Quoted 9 lines · Aditya Srivastava
Currently checkpatch warns us if there is no 'Signed-off-by' line for the patch.
E.g., running checkpatch on commit
f68e7927212f("Revert "powerpc/book3s32: Reorder_PAGE_XXXflags to simplify TLB handling"") reports this error:ERROR: Missing Signed-off-by: line(s)
Quoted 9 lines
Quoted 3 lines
Provide a fix by adding a Signed-off-by line corresponding to the author of the patch before the start of diff(s)
Can you please provide an evaluation first?
As far as remember, the fix is often not to add a Signed-off-by: tag but it requires something completely different.
Quoted 7 lines
I have generated the 'git logs' of the commits causing
MISSING_SIGN_OFFat:
https://github.com/AdityaSrivast/kernel-tasks/blob/master/Task7/summary_log.txtActually this fix was suggested by Joe at:
https://lore.kernel.org/linux-kernel-mentees/[email protected]/Yes I know. Now look at the reports.
The rc and release commit tags do not get a Signed-off-by intentionally. Other than that, reverts (for reverts is probably best to explain how to do a revert... so that a sign-off-by is included) and typos.
Quoted 7 lines
Quoted 2 lines
Lukas
Yes, I agree. But for the typos, the user must get
BAD_SIGN_OFFwarning for "Non-standard signature". So user will have to fix that manually. If so, this error is already avoided.
Quoted 6 lines
But then the fix should not be applied if there is a
BAD_SIGN_OFFwarning, right?Typos can also be fixed automatically by a fuzzy match. That is a different feature, though and a different (next) patch.
Okay.
Quoted 5 lines
Quoted 2 lines
For the release commits, I think the user(s) may not use checkpatch
Agree. You can filter those out of your evaluation.
Quoted 8 lines
Quoted 5 lines
For the rest (ie reverts) with no sign-offs, I think that if we just add the sign off line, it serves our purpose.
Of course if we explain them to revert with sign-off, it will be probably the same outcome.Then do both. Provide a fix in checkpatch.pl and provide documentation.
Okay.
Quoted 2 lines
So, how many are because of reverts and how many are because of typos?
Reverts: 4,
Typos: 5
True positives: 2 (3c0edea9b29f9be6, 9ac060a708e05423)
Quoted 9 lines
Also, how many reverts do currently include a proper sign-off?
Quoted 1 line
When the majority does not include a proper sign-off on revert commit,
maybe the convention is to not have a sign-off on reverts. When we have some data on that, we can discuss this with some central maintainers in the kernel community.
If that is the case, then the fix is to change checkpatch.pl not to complain on revert commits because of a missing sign-off.
So, there are 993 commits which are reverts. Out of these only 4 are there which have missing sign offs.(over 4.13..5.8)
I have a doubt, How can I provide documentation? Couldn't find any doc file for checkpatch
Thanks
Aditya
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
Quoted 75 lines · Aditya
Quoted 52 lines · Lukas Bulwahn
Quoted 43 lines · Aditya
Quoted 41 lines · Lukas Bulwahn
Quoted 24 lines · Aditya
Quoted 12 lines · Lukas Bulwahn
Quoted 9 lines · Aditya Srivastava
Currently checkpatch warns us if there is no 'Signed-off-by' line for the patch.
E.g., running checkpatch on commit
f68e7927212f("Revert "powerpc/book3s32: Reorder_PAGE_XXXflags to simplify TLB handling"") reports this error:ERROR: Missing Signed-off-by: line(s)
Quoted 9 lines
Quoted 3 lines
Provide a fix by adding a Signed-off-by line corresponding to the author of the patch before the start of diff(s)
Can you please provide an evaluation first?
As far as remember, the fix is often not to add a Signed-off-by: tag but it requires something completely different.
Quoted 7 lines
I have generated the 'git logs' of the commits causing
MISSING_SIGN_OFFat:
https://github.com/AdityaSrivast/kernel-tasks/blob/master/Task7/summary_log.txtActually this fix was suggested by Joe at:
https://lore.kernel.org/linux-kernel-mentees/[email protected]/Yes I know. Now look at the reports.
The rc and release commit tags do not get a Signed-off-by intentionally. Other than that, reverts (for reverts is probably best to explain how to do a revert... so that a sign-off-by is included) and typos.
Quoted 7 lines
Quoted 2 lines
Lukas
Yes, I agree. But for the typos, the user must get
BAD_SIGN_OFFwarning for "Non-standard signature". So user will have to fix that manually. If so, this error is already avoided.Quoted 6 lines
But then the fix should not be applied if there is a
BAD_SIGN_OFFwarning, right?Typos can also be fixed automatically by a fuzzy match. That is a different feature, though and a different (next) patch.
Okay.
Quoted 5 lines
Quoted 2 lines
For the release commits, I think the user(s) may not use checkpatch
Agree. You can filter those out of your evaluation.
Quoted 8 lines
Quoted 5 lines
For the rest (ie reverts) with no sign-offs, I think that if we just add the sign off line, it serves our purpose.
Of course if we explain them to revert with sign-off, it will be probably the same outcome.Then do both. Provide a fix in checkpatch.pl and provide documentation.
Quoted 9 lines
Okay.
Quoted 2 lines
So, how many are because of reverts and how many are because of typos?
Reverts: 4,
Typos: 5
True positives: 2 (3c0edea9b29f9be6,9ac060a708e05423)
So for Reverts and the true positives, your suggested fix works.
For the typos cases, your suggested fix does not work.
You can add this fix but maybe you can also work on how to fix the typo case. You might consider that the fix is not suggested when there is still an BAD_SIGNOFF warning (because then it is probably a typo).
I think for the typos in tags, it will emit the BAD_SIGNOFF warning. You can add a fix option to correct the string by some fuzzy match and then correct the Signed-off-by: tag.
Quoted 6 lines
Quoted 6 lines
Also, how many reverts do currently include a proper sign-off?
Quoted 1 line
When the majority does not include a proper sign-off on revert commit,
maybe the convention is to not have a sign-off on reverts. When we have some data on that, we can discuss this with some central maintainers in the kernel community.
Quoted 9 lines
Quoted 3 lines
If that is the case, then the fix is to change checkpatch.pl not to complain on revert commits because of a missing sign-off.
So, there are 993 commits which are reverts. Out of these only 4 are there which have missing sign offs.(over 4.13..5.8)
I have a doubt, How can I provide documentation? Couldn't find any doc file for checkpatch
Add an additional hint can be added here:
E.g., that also reverts should include a Signed-off-by: and that git revert <some option> does that for you.
Lukas
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees