checkpatch: Add checking if from-author sign-off is last
PATCH 1/1 checkpatch: Add checking if from-author sign-off is last
Print a check if the last Signed-off-by is by the From: author.
submitting-patches.rst states 'the last Signed-off-by: must always be that of the developer submitting the patch.'.
This patch tries to enforce this, under the assumption that the From:
author is that developer.
Suggested-by Tobias Langer <[email protected]>
Co-developed-by Ferdinand Schober <[email protected]>
Signed-off-by Ferdinand Schober <[email protected]>
Signed-off-by Philipp Bruegmann <[email protected]>
--- scripts/checkpatch.pl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
scripts/checkpatch.pl +8 -2
@@ -2447,6 +2447,7 @@ sub process { my $author = ''; my $authorsignoff = 0; my $author_sob = ''; + my $last_sign_off = ''; my $is_patch = 0; my $is_binding_patch = -1; my $in_header_lines = $file ? 0 : 1;
@@ -2774,8 +2775,9 @@ sub process { if ($line =~ /^\s*signed-off-by:\s*(.*)/i) { $signoff++; $in_commit_log = 0; + $last_sign_off = $1; if ($author ne '' && $authorsignoff != 1) { - if (same_email_addresses($1, $author)) { + if (same_email_addresses($last_sign_off, $author)) { $authorsignoff = 1; } else { my $ctx = $1;
@@ -7238,7 +7240,7 @@ sub process { if ($signoff == 0) { ERROR("MISSING_SIGN_OFF", "Missing Signed-off-by: line(s)\n"); - } elsif ($authorsignoff != 1) { + } else { # authorsignoff values: # 0 -> missing sign off # 1 -> sign off identical
@@ -7252,6 +7254,10 @@ sub process { if ($authorsignoff == 0) { ERROR("NO_AUTHOR_SIGN_OFF", "Missing Signed-off-by: line by nominal patch author '$author'\n"); + } elsif ($authorsignoff == 1 && $last_sign_off ne $author) { + CHK("FROM_SIGN_OFF_NOT_LAST", + "Signed-off-by: line by nominal patch author is not the last signature.\n\ + The author submitting the patch should be signing last.\n"); } elsif ($authorsignoff == 2) { CHK("FROM_SIGN_OFF_MISMATCH", "From:/Signed-off-by: email comments mismatch: $sob_msg\n");
Signature · 1 line
2.20.1
Joe Perches
maintainerQuoted 6 lines · Philipp Bruegmann
Print a check if the last Signed-off-by is by the From: author.
submitting-patches.rststates 'the last Signed-off-by: must always be that of the developer submitting the patch.'.
This patch tries to enforce this, under the assumption that the From:
author is that developer.
Bad assumption. Commonly the person submitting a patch is an upstream maintainer, not the developer.