Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1451569 > unrolled thread
| Started by | Allen Hubbe <allenbh@gmail.com> |
|---|---|
| First post | 2016-07-28 01:10 +0200 |
| Last post | 2016-07-28 04:00 +0200 |
| Articles | 5 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] checkpatch: check signoff when reading stdin Allen Hubbe <allenbh@gmail.com> - 2016-07-28 01:10 +0200
Re: [PATCH] checkpatch: check signoff when reading stdin Joe Perches <joe@perches.com> - 2016-07-28 02:50 +0200
Re: [PATCH] checkpatch: check signoff when reading stdin Allen Hubbe <allenbh@gmail.com> - 2016-07-29 16:50 +0200
Re: [PATCH] checkpatch: check signoff when reading stdin Joe Perches <joe@perches.com> - 2016-07-29 17:40 +0200
[PATCH v2] checkpatch: check signoff when reading stdin Allen Hubbe <allenbh@gmail.com> - 2016-07-28 04:00 +0200
| From | Allen Hubbe <allenbh@gmail.com> |
|---|---|
| Date | 2016-07-28 01:10 +0200 |
| Subject | [PATCH] checkpatch: check signoff when reading stdin |
| Message-ID | <rZG7D-62u-29@gated-at.bofh.it> |
Before, signoff was not checked if the filename is '-', indicating
reading the patch from stdin. This causes commands such as below not to
warn about a missing signoff.
git show --pretty=email | scripts/checkpatch.pl -
As a workaround, the command could be modified to refer to stdin by a
name other than '-'. The workaround is not an elegant solution, because
elsewhere checkpatch uses the fact that filename equals '-' is special
for stdin, such as setting '$vname' to 'Your patch'.
git show --pretty=email | scripts/checkpatch.pl /dev/stdin
This change causes checkpatch to check for a missing signoff line, even
if the filename is '-', as in the first variation of the command.
Signed-off-by: Allen Hubbe <allenbh@gmail.com>
---
scripts/checkpatch.pl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 4904ced676d4..83acbac10705 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -6045,7 +6045,7 @@ sub process {
ERROR("NOT_UNIFIED_DIFF",
"Does not appear to be a unified-diff format patch\n");
}
- if ($is_patch && $filename ne '-' && $chk_signoff && $signoff == 0) {
+ if ($is_patch && $chk_signoff && $signoff == 0) {
ERROR("MISSING_SIGN_OFF",
"Missing Signed-off-by: line(s)\n");
}
--
2.9.1
[toc] | [next] | [standalone]
| From | Joe Perches <joe@perches.com> |
|---|---|
| Date | 2016-07-28 02:50 +0200 |
| Message-ID | <rZHGq-70S-3@gated-at.bofh.it> |
| In reply to | #1451569 |
> This change causes checkpatch to check for a missing signoff line, even > if the filename is '-', as in the first variation of the command. I think this is not a great idea because the most likely use case is piping git diff output ala: $ git diff <some_path> | ./scripts/checkpatch.pl -
[toc] | [prev] | [next] | [standalone]
| From | Allen Hubbe <allenbh@gmail.com> |
|---|---|
| Date | 2016-07-29 16:50 +0200 |
| Message-ID | <s0hgS-5SV-3@gated-at.bofh.it> |
| In reply to | #1451605 |
On Wed, Jul 27, 2016 at 8:41 PM, Joe Perches <joe@perches.com> wrote: > I think this is not a great idea because the most likely > use case is piping git diff output ala: > > $ git diff <some_path> | ./scripts/checkpatch.pl - Thanks for the review. Has v2 addressed your concern?
[toc] | [prev] | [next] | [standalone]
| From | Joe Perches <joe@perches.com> |
|---|---|
| Date | 2016-07-29 17:40 +0200 |
| Message-ID | <s0i3g-6ue-7@gated-at.bofh.it> |
| In reply to | #1452426 |
On Fri, 2016-07-29 at 10:45 -0400, Allen Hubbe wrote: > On Wed, Jul 27, 2016 at 8:41 PM, Joe Perches <joe@perches.com> wrote: > > > > I think this is not a great idea because the most likely > > use case is piping git diff output ala: > > > > $ git diff <some_path> | ./scripts/checkpatch.pl - > Thanks for the review. Has v2 addressed your concern? Hi Allen. For the most part, yes, your V2 works better. I was wondering if the - should be optional and thinking $ git diff <some-path> | ./scripts/checkpatch.pl should work the same way, but I guess that can wait for another day, so Acked-by: Joe Perches <joe@perches.com> cheers, Joe
[toc] | [prev] | [next] | [standalone]
| From | Allen Hubbe <allenbh@gmail.com> |
|---|---|
| Date | 2016-07-28 04:00 +0200 |
| Subject | [PATCH v2] checkpatch: check signoff when reading stdin |
| Message-ID | <rZIM9-7Es-9@gated-at.bofh.it> |
| In reply to | #1451569 |
Signoff was not checked if the filename is '-', indicating reading the
patch from stdin. Commands such as the below would not warn about a
missing signoff, because the patch filename is '-'. This change allows
checkpatch to warn about a missing signoff, even if the input filename
is '-', but only if the patch has a commit message.
git show --pretty=email | scripts/checkpatch.pl -
A more common use of checkpatch with stdin is for piping git diff
through checkpatch. The diff output would not contain a commit message,
and therefore it would not contain a signoff line. For this common use
case, a warning should not be printed about the missing signoff. With
this change we will only warn about a missing signoff if the input
contains a commit message.
git diff | scripts/checkpatch.pl -
Before this patch, a workaround for the first command was to refer to
stdin by a name other than '-'. The workaround is not an elegant
solution, because elsewhere checkpatch uses the fact that filename
equals '-', such as in setting '$vname' to 'Your patch' for stdin. The
command below would report "/dev/stdin has style problems" instead of
"Your patch has style problems."
git show --pretty=email | scripts/checkpatch.pl /dev/stdin
Signed-off-by: Allen Hubbe <allenbh@gmail.com>
---
scripts/checkpatch.pl | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 4904ced676d4..9be0343baa77 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2064,6 +2064,7 @@ sub process {
my $is_patch = 0;
my $in_header_lines = $file ? 0 : 1;
my $in_commit_log = 0; #Scanning lines before patch
+ my $has_commit_log = 0; #Encountered lines before patch
my $commit_log_possible_stack_dump = 0;
my $commit_log_long_line = 0;
my $commit_log_has_diff = 0;
@@ -2561,6 +2562,7 @@ sub process {
$rawline =~ /^(commit\b|from\b|[\w-]+:).*$/i)) {
$in_header_lines = 0;
$in_commit_log = 1;
+ $has_commit_log = 1;
}
# Check if there is UTF-8 in a commit log when a mail header has explicitly
@@ -6045,7 +6047,7 @@ sub process {
ERROR("NOT_UNIFIED_DIFF",
"Does not appear to be a unified-diff format patch\n");
}
- if ($is_patch && $filename ne '-' && $chk_signoff && $signoff == 0) {
+ if ($is_patch && $has_commit_log && $chk_signoff && $signoff == 0) {
ERROR("MISSING_SIGN_OFF",
"Missing Signed-off-by: line(s)\n");
}
--
2.9.1
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web