qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2 0/5] checkpatch: backport UTF-8 fixes and MAINTAINERS check
@ 2018-04-30 12:46 Stefan Hajnoczi
  2018-04-30 12:46 ` [Qemu-devel] [PATCH v2 1/5] checkpatch: add a --strict check for utf-8 in commit logs Stefan Hajnoczi
                   ` (7 more replies)
  0 siblings, 8 replies; 13+ messages in thread
From: Stefan Hajnoczi @ 2018-04-30 12:46 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Markus Armbruster, Fam Zheng, Thomas Huth,
	Marc-André Lureau

v2:
 * Resolve missing CHK() [Thomas]
 * Drop first argument to WARN() to match QEMU function arguments

This series cherry picks checkpatch UTF-8 fixes and the MAINTAINERS file check
from Linux.  Thomas Huth original did the backport in January 2017 but the
series was forgotten (<1485436265-12573-1-git-send-email-thuth@redhat.com>).  I
did the cherry pick again from scratch.

The MAINTAINERS file check prints a warning when new files are added without a
modification to ./MAINTAINERS.  It is easy to forget to update ./MAINTAINERS
and this check should help us stay on top of new source files.

Joe Perches (4):
  checkpatch: add a --strict check for utf-8 in commit logs
  checkpatch: ignore email headers better
  checkpatch: emit a warning on file add/move/delete
  checkpatch: reduce MAINTAINERS update message frequency

Pasi Savanainen (1):
  checkpatch: check utf-8 content from a commit log when it's missing
    from charset

 scripts/checkpatch.pl | 56 +++++++++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 52 insertions(+), 4 deletions(-)

-- 
2.14.3

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Qemu-devel] [PATCH v2 1/5] checkpatch: add a --strict check for utf-8 in commit logs
  2018-04-30 12:46 [Qemu-devel] [PATCH v2 0/5] checkpatch: backport UTF-8 fixes and MAINTAINERS check Stefan Hajnoczi
@ 2018-04-30 12:46 ` Stefan Hajnoczi
  2018-05-02  5:32   ` Thomas Huth
  2018-04-30 12:46 ` [Qemu-devel] [PATCH v2 2/5] checkpatch: check utf-8 content from a commit log when it's missing from charset Stefan Hajnoczi
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 13+ messages in thread
From: Stefan Hajnoczi @ 2018-04-30 12:46 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Markus Armbruster, Fam Zheng, Thomas Huth,
	Marc-André Lureau

From: Joe Perches <joe@perches.com>

Some find using utf-8 in commit logs inappropriate.

Some patch commit logs contain unintended utf-8 characters when doing
things like copy/pasting compilation output.

Look for the start of any commit log by skipping initial lines that look
like email headers and "From: " lines.

Stop looking for utf-8 at the first signature line.

Signed-off-by: Joe Perches <joe@perches.com>
Suggested-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit 15662b3e8644905032c2e26808401a487d4e90c1)
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>

Conflicts:
  QEMU does not have CHK(), use WARN() instead.

  QEMU WARN() only takes one argument, drop the 'type' value in the
  first argument.
---
 scripts/checkpatch.pl | 30 ++++++++++++++++++++++++++----
 1 file changed, 26 insertions(+), 4 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 5b8735defb..c667d085ae 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -224,9 +224,8 @@ our $NonptrType;
 our $Type;
 our $Declare;
 
-our $UTF8	= qr {
-	[\x09\x0A\x0D\x20-\x7E]              # ASCII
-	| [\xC2-\xDF][\x80-\xBF]             # non-overlong 2-byte
+our $NON_ASCII_UTF8	= qr{
+	[\xC2-\xDF][\x80-\xBF]               # non-overlong 2-byte
 	|  \xE0[\xA0-\xBF][\x80-\xBF]        # excluding overlongs
 	| [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}  # straight 3-byte
 	|  \xED[\x80-\x9F][\x80-\xBF]        # excluding surrogates
@@ -235,6 +234,11 @@ our $UTF8	= qr {
 	|  \xF4[\x80-\x8F][\x80-\xBF]{2}     # plane 16
 }x;
 
+our $UTF8	= qr{
+	[\x09\x0A\x0D\x20-\x7E]              # ASCII
+	| $NON_ASCII_UTF8
+}x;
+
 # There are still some false positives, but this catches most
 # common cases.
 our $typeTypedefs = qr{(?x:
@@ -1179,6 +1183,9 @@ sub process {
 	my $signoff = 0;
 	my $is_patch = 0;
 
+	my $in_header_lines = 1;
+	my $in_commit_log = 0;		#Scanning lines before patch
+
 	our @report = ();
 	our $cnt_lines = 0;
 	our $cnt_error = 0;
@@ -1331,7 +1338,6 @@ sub process {
 		if ($line =~ /^diff --git.*?(\S+)$/) {
 			$realfile = $1;
 			$realfile =~ s@^([^/]*)/@@;
-
 		} elsif ($line =~ /^\+\+\+\s+(\S+)/) {
 			$realfile = $1;
 			$realfile =~ s@^([^/]*)/@@;
@@ -1370,6 +1376,8 @@ sub process {
 		if ($line =~ /^\s*signed-off-by:/i) {
 			# This is a signoff, if ugly, so do not double report.
 			$signoff++;
+			$in_commit_log = 0;
+
 			if (!($line =~ /^\s*Signed-off-by:/)) {
 				ERROR("The correct form is \"Signed-off-by\"\n" .
 					$herecurr);
@@ -1398,6 +1406,20 @@ sub process {
 			ERROR("Invalid UTF-8, patch and commit message should be encoded in UTF-8\n" . $hereptr);
 		}
 
+# Check if it's the start of a commit log
+# (not a header line and we haven't seen the patch filename)
+		if ($in_header_lines && $realfile =~ /^$/ &&
+		    $rawline !~ /^(commit\b|from\b|\w+:).+$/i) {
+			$in_header_lines = 0;
+			$in_commit_log = 1;
+		}
+
+# Still not yet in a patch, check for any UTF-8
+		if ($in_commit_log && $realfile =~ /^$/ &&
+		    $rawline =~ /$NON_ASCII_UTF8/) {
+			WARN("8-bit UTF-8 used in possible commit log\n" . $herecurr);
+		}
+
 # ignore non-hunk lines and lines being removed
 		next if (!$hunk_line || $line =~ /^-/);
 
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [Qemu-devel] [PATCH v2 2/5] checkpatch: check utf-8 content from a commit log when it's missing from charset
  2018-04-30 12:46 [Qemu-devel] [PATCH v2 0/5] checkpatch: backport UTF-8 fixes and MAINTAINERS check Stefan Hajnoczi
  2018-04-30 12:46 ` [Qemu-devel] [PATCH v2 1/5] checkpatch: add a --strict check for utf-8 in commit logs Stefan Hajnoczi
@ 2018-04-30 12:46 ` Stefan Hajnoczi
  2018-04-30 12:46 ` [Qemu-devel] [PATCH v2 3/5] checkpatch: ignore email headers better Stefan Hajnoczi
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Stefan Hajnoczi @ 2018-04-30 12:46 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Markus Armbruster, Fam Zheng, Thomas Huth,
	Marc-André Lureau

From: Pasi Savanainen <pasi.savanainen@nixu.com>

Check that a commit log doesn't contain UTF-8 when a mail header
explicitly defines a different charset, like

'Content-Type: text/plain; charset="us-ascii"'

Signed-off-by: Pasi Savanainen <pasi.savanainen@nixu.com>
Cc: Joe Perches <joe@perches.com>
Cc: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit fa64205df9dfd7b7662cc64a7e82115c00e428e5)
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
---
 scripts/checkpatch.pl | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index c667d085ae..25bf43bad0 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1186,6 +1186,8 @@ sub process {
 	my $in_header_lines = 1;
 	my $in_commit_log = 0;		#Scanning lines before patch
 
+	my $non_utf8_charset = 0;
+
 	our @report = ();
 	our $cnt_lines = 0;
 	our $cnt_error = 0;
@@ -1414,8 +1416,15 @@ sub process {
 			$in_commit_log = 1;
 		}
 
-# Still not yet in a patch, check for any UTF-8
-		if ($in_commit_log && $realfile =~ /^$/ &&
+# Check if there is UTF-8 in a commit log when a mail header has explicitly
+# declined it, i.e defined some charset where it is missing.
+		if ($in_header_lines &&
+		    $rawline =~ /^Content-Type:.+charset="(.+)".*$/ &&
+		    $1 !~ /utf-8/i) {
+			$non_utf8_charset = 1;
+		}
+
+		if ($in_commit_log && $non_utf8_charset && $realfile =~ /^$/ &&
 		    $rawline =~ /$NON_ASCII_UTF8/) {
 			WARN("8-bit UTF-8 used in possible commit log\n" . $herecurr);
 		}
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [Qemu-devel] [PATCH v2 3/5] checkpatch: ignore email headers better
  2018-04-30 12:46 [Qemu-devel] [PATCH v2 0/5] checkpatch: backport UTF-8 fixes and MAINTAINERS check Stefan Hajnoczi
  2018-04-30 12:46 ` [Qemu-devel] [PATCH v2 1/5] checkpatch: add a --strict check for utf-8 in commit logs Stefan Hajnoczi
  2018-04-30 12:46 ` [Qemu-devel] [PATCH v2 2/5] checkpatch: check utf-8 content from a commit log when it's missing from charset Stefan Hajnoczi
@ 2018-04-30 12:46 ` Stefan Hajnoczi
  2018-04-30 12:46 ` [Qemu-devel] [PATCH v2 4/5] checkpatch: emit a warning on file add/move/delete Stefan Hajnoczi
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Stefan Hajnoczi @ 2018-04-30 12:46 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Markus Armbruster, Fam Zheng, Thomas Huth,
	Marc-André Lureau

From: Joe Perches <joe@perches.com>

There are some patches created by git format-patch that when scanned by
checkpatch report errors on lines like

To:	address.tld

This is a checkpatch false positive.

Improve the logic a bit to ignore folded email headers to avoid emitting
these messages.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit 29ee1b0c67e0dd7dea8dd718e8326076bce5b6fe)
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
---
 scripts/checkpatch.pl | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 25bf43bad0..20d5b62586 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1183,7 +1183,7 @@ sub process {
 	my $signoff = 0;
 	my $is_patch = 0;
 
-	my $in_header_lines = 1;
+	my $in_header_lines = $file ? 0 : 1;
 	my $in_commit_log = 0;		#Scanning lines before patch
 
 	my $non_utf8_charset = 0;
@@ -1411,7 +1411,8 @@ sub process {
 # Check if it's the start of a commit log
 # (not a header line and we haven't seen the patch filename)
 		if ($in_header_lines && $realfile =~ /^$/ &&
-		    $rawline !~ /^(commit\b|from\b|\w+:).+$/i) {
+		    !($rawline =~ /^\s+\S/ ||
+		      $rawline =~ /^(commit\b|from\b|[\w-]+:).*$/i)) {
 			$in_header_lines = 0;
 			$in_commit_log = 1;
 		}
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [Qemu-devel] [PATCH v2 4/5] checkpatch: emit a warning on file add/move/delete
  2018-04-30 12:46 [Qemu-devel] [PATCH v2 0/5] checkpatch: backport UTF-8 fixes and MAINTAINERS check Stefan Hajnoczi
                   ` (2 preceding siblings ...)
  2018-04-30 12:46 ` [Qemu-devel] [PATCH v2 3/5] checkpatch: ignore email headers better Stefan Hajnoczi
@ 2018-04-30 12:46 ` Stefan Hajnoczi
  2018-04-30 12:46 ` [Qemu-devel] [PATCH v2 5/5] checkpatch: reduce MAINTAINERS update message frequency Stefan Hajnoczi
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Stefan Hajnoczi @ 2018-04-30 12:46 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Markus Armbruster, Fam Zheng, Thomas Huth,
	Marc-André Lureau

From: Joe Perches <joe@perches.com>

Whenever files are added, moved, or deleted, the MAINTAINERS file
patterns can be out of sync or outdated.

To try to keep MAINTAINERS more up-to-date, add a one-time warning
whenever a patch does any of those.

Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit 13f1937ef33950b1112049972249e6191b82e6c9)
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>

Conflicts:
  QEMU WARN() only takes one argument, drop the 'type' value in the
  first argument.
---
 scripts/checkpatch.pl | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 20d5b62586..84bdf53af7 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1185,7 +1185,7 @@ sub process {
 
 	my $in_header_lines = $file ? 0 : 1;
 	my $in_commit_log = 0;		#Scanning lines before patch
-
+	my $reported_maintainer_file = 0;
 	my $non_utf8_charset = 0;
 
 	our @report = ();
@@ -1390,6 +1390,16 @@ sub process {
 			}
 		}
 
+# Check for added, moved or deleted files
+		if (!$reported_maintainer_file && !$in_commit_log &&
+		    ($line =~ /^(?:new|deleted) file mode\s*\d+\s*$/ ||
+		     $line =~ /^rename (?:from|to) [\w\/\.\-]+\s*$/ ||
+		     ($line =~ /\{\s*([\w\/\.\-]*)\s*\=\>\s*([\w\/\.\-]*)\s*\}/ &&
+		      (defined($1) || defined($2))))) {
+			$reported_maintainer_file = 1;
+			WARN("added, moved or deleted file(s), does MAINTAINERS need updating?\n" . $herecurr);
+		}
+
 # Check for wrappage within a valid hunk of the file
 		if ($realcnt != 0 && $line !~ m{^(?:\+|-| |\\ No newline|$)}) {
 			ERROR("patch seems to be corrupt (line wrapped?)\n" .
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [Qemu-devel] [PATCH v2 5/5] checkpatch: reduce MAINTAINERS update message frequency
  2018-04-30 12:46 [Qemu-devel] [PATCH v2 0/5] checkpatch: backport UTF-8 fixes and MAINTAINERS check Stefan Hajnoczi
                   ` (3 preceding siblings ...)
  2018-04-30 12:46 ` [Qemu-devel] [PATCH v2 4/5] checkpatch: emit a warning on file add/move/delete Stefan Hajnoczi
@ 2018-04-30 12:46 ` Stefan Hajnoczi
  2018-04-30 12:56 ` [Qemu-devel] [PATCH v2 0/5] checkpatch: backport UTF-8 fixes and MAINTAINERS check no-reply
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Stefan Hajnoczi @ 2018-04-30 12:46 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Markus Armbruster, Fam Zheng, Thomas Huth,
	Marc-André Lureau

From: Joe Perches <joe@perches.com>

When files are being added/moved/deleted and a patch contains an update to
the MAINTAINERS file, assume it's to update the MAINTAINERS file correctly
and do not emit the "does MAINTAINERS need updating?" message.

Reported by many people.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from e0d975b1b439c4fef58fbc306c542c94f48bb849)
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
---
 scripts/checkpatch.pl | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 84bdf53af7..5506502cf4 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1390,6 +1390,12 @@ sub process {
 			}
 		}
 
+# Check if MAINTAINERS is being updated.  If so, there's probably no need to
+# emit the "does MAINTAINERS need updating?" message on file add/move/delete
+		if ($line =~ /^\s*MAINTAINERS\s*\|/) {
+			$reported_maintainer_file = 1;
+		}
+
 # Check for added, moved or deleted files
 		if (!$reported_maintainer_file && !$in_commit_log &&
 		    ($line =~ /^(?:new|deleted) file mode\s*\d+\s*$/ ||
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [Qemu-devel] [PATCH v2 0/5] checkpatch: backport UTF-8 fixes and MAINTAINERS check
  2018-04-30 12:46 [Qemu-devel] [PATCH v2 0/5] checkpatch: backport UTF-8 fixes and MAINTAINERS check Stefan Hajnoczi
                   ` (4 preceding siblings ...)
  2018-04-30 12:46 ` [Qemu-devel] [PATCH v2 5/5] checkpatch: reduce MAINTAINERS update message frequency Stefan Hajnoczi
@ 2018-04-30 12:56 ` no-reply
  2018-05-01 13:04   ` Stefan Hajnoczi
  2018-05-02 16:50 ` Markus Armbruster
  2018-05-10  9:42 ` Stefan Hajnoczi
  7 siblings, 1 reply; 13+ messages in thread
From: no-reply @ 2018-04-30 12:56 UTC (permalink / raw)
  To: stefanha; +Cc: famz, qemu-devel, peter.maydell, thuth

Hi,

This series seems to have some coding style problems. See output below for
more information:

Type: series
Message-id: 20180430124651.10340-1-stefanha@redhat.com
Subject: [Qemu-devel] [PATCH v2 0/5] checkpatch: backport UTF-8 fixes and MAINTAINERS check

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram

commits="$(git log --format=%H --reverse $BASE..)"
for c in $commits; do
    echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
    if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
        failed=1
        echo
    fi
    n=$((n+1))
done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 t [tag update]            patchew/20180421163957.29872-1-mreitz@redhat.com -> patchew/20180421163957.29872-1-mreitz@redhat.com
 * [new tag]               patchew/20180430124651.10340-1-stefanha@redhat.com -> patchew/20180430124651.10340-1-stefanha@redhat.com
Switched to a new branch 'test'
19015a6f3e checkpatch: reduce MAINTAINERS update message frequency
7fb20f970d checkpatch: emit a warning on file add/move/delete
9303812d85 checkpatch: ignore email headers better
f7cec089ae checkpatch: check utf-8 content from a commit log when it's missing from charset
d6a1291e63 checkpatch: add a --strict check for utf-8 in commit logs

=== OUTPUT BEGIN ===
Checking PATCH 1/5: checkpatch: add a --strict check for utf-8 in commit logs...
WARNING: line over 80 characters
#101: FILE: scripts/checkpatch.pl:1420:
+			WARN("8-bit UTF-8 used in possible commit log\n" . $herecurr);

total: 0 errors, 1 warnings, 66 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
Checking PATCH 2/5: checkpatch: check utf-8 content from a commit log when it's missing from charset...
Checking PATCH 3/5: checkpatch: ignore email headers better...
Checking PATCH 4/5: checkpatch: emit a warning on file add/move/delete...
WARNING: line over 80 characters
#46: FILE: scripts/checkpatch.pl:1397:
+		     ($line =~ /\{\s*([\w\/\.\-]*)\s*\=\>\s*([\w\/\.\-]*)\s*\}/ &&

ERROR: line over 90 characters
#49: FILE: scripts/checkpatch.pl:1400:
+			WARN("added, moved or deleted file(s), does MAINTAINERS need updating?\n" . $herecurr);

total: 1 errors, 1 warnings, 24 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

Checking PATCH 5/5: checkpatch: reduce MAINTAINERS update message frequency...
=== OUTPUT END ===

Test command exited with code: 1


---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel@redhat.com

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Qemu-devel] [PATCH v2 0/5] checkpatch: backport UTF-8 fixes and MAINTAINERS check
  2018-04-30 12:56 ` [Qemu-devel] [PATCH v2 0/5] checkpatch: backport UTF-8 fixes and MAINTAINERS check no-reply
@ 2018-05-01 13:04   ` Stefan Hajnoczi
  2018-05-02  5:23     ` Thomas Huth
  2018-05-03  6:21     ` Fam Zheng
  0 siblings, 2 replies; 13+ messages in thread
From: Stefan Hajnoczi @ 2018-05-01 13:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: famz, peter.maydell, thuth, armbru, marcandre.lureau

[-- Attachment #1: Type: text/plain, Size: 1604 bytes --]

On Mon, Apr 30, 2018 at 05:56:30AM -0700, no-reply@patchew.org wrote:
> === OUTPUT BEGIN ===
> Checking PATCH 1/5: checkpatch: add a --strict check for utf-8 in commit logs...
> WARNING: line over 80 characters
> #101: FILE: scripts/checkpatch.pl:1420:
> +			WARN("8-bit UTF-8 used in possible commit log\n" . $herecurr);
> 
> total: 0 errors, 1 warnings, 66 lines checked
> 
> Your patch has style problems, please review.  If any of these errors
> are false positives report them to the maintainer, see
> CHECKPATCH in MAINTAINERS.
> Checking PATCH 2/5: checkpatch: check utf-8 content from a commit log when it's missing from charset...
> Checking PATCH 3/5: checkpatch: ignore email headers better...
> Checking PATCH 4/5: checkpatch: emit a warning on file add/move/delete...
> WARNING: line over 80 characters
> #46: FILE: scripts/checkpatch.pl:1397:
> +		     ($line =~ /\{\s*([\w\/\.\-]*)\s*\=\>\s*([\w\/\.\-]*)\s*\}/ &&
> 
> ERROR: line over 90 characters
> #49: FILE: scripts/checkpatch.pl:1400:
> +			WARN("added, moved or deleted file(s), does MAINTAINERS need updating?\n" . $herecurr);
> 
> total: 1 errors, 1 warnings, 24 lines checked
> 
> Your patch has style problems, please review.  If any of these errors
> are false positives report them to the maintainer, see
> CHECKPATCH in MAINTAINERS.
> 
> Checking PATCH 5/5: checkpatch: reduce MAINTAINERS update message frequency...
> === OUTPUT END ===

If there are no objections I'd like to keep this in sync with upstream,
and error messages are exempt from the 80 char limit to aid grepping.

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Qemu-devel] [PATCH v2 0/5] checkpatch: backport UTF-8 fixes and MAINTAINERS check
  2018-05-01 13:04   ` Stefan Hajnoczi
@ 2018-05-02  5:23     ` Thomas Huth
  2018-05-03  6:21     ` Fam Zheng
  1 sibling, 0 replies; 13+ messages in thread
From: Thomas Huth @ 2018-05-02  5:23 UTC (permalink / raw)
  To: Stefan Hajnoczi, qemu-devel; +Cc: famz, peter.maydell, armbru, marcandre.lureau

[-- Attachment #1: Type: text/plain, Size: 1871 bytes --]

On 01.05.2018 15:04, Stefan Hajnoczi wrote:
> On Mon, Apr 30, 2018 at 05:56:30AM -0700, no-reply@patchew.org wrote:
>> === OUTPUT BEGIN ===
>> Checking PATCH 1/5: checkpatch: add a --strict check for utf-8 in commit logs...
>> WARNING: line over 80 characters
>> #101: FILE: scripts/checkpatch.pl:1420:
>> +			WARN("8-bit UTF-8 used in possible commit log\n" . $herecurr);
>>
>> total: 0 errors, 1 warnings, 66 lines checked
>>
>> Your patch has style problems, please review.  If any of these errors
>> are false positives report them to the maintainer, see
>> CHECKPATCH in MAINTAINERS.
>> Checking PATCH 2/5: checkpatch: check utf-8 content from a commit log when it's missing from charset...
>> Checking PATCH 3/5: checkpatch: ignore email headers better...
>> Checking PATCH 4/5: checkpatch: emit a warning on file add/move/delete...
>> WARNING: line over 80 characters
>> #46: FILE: scripts/checkpatch.pl:1397:
>> +		     ($line =~ /\{\s*([\w\/\.\-]*)\s*\=\>\s*([\w\/\.\-]*)\s*\}/ &&
>>
>> ERROR: line over 90 characters
>> #49: FILE: scripts/checkpatch.pl:1400:
>> +			WARN("added, moved or deleted file(s), does MAINTAINERS need updating?\n" . $herecurr);
>>
>> total: 1 errors, 1 warnings, 24 lines checked
>>
>> Your patch has style problems, please review.  If any of these errors
>> are false positives report them to the maintainer, see
>> CHECKPATCH in MAINTAINERS.
>>
>> Checking PATCH 5/5: checkpatch: reduce MAINTAINERS update message frequency...
>> === OUTPUT END ===
> 
> If there are no objections I'd like to keep this in sync with upstream,
> and error messages are exempt from the 80 char limit to aid grepping.

Yes, please keep it as close as possible to upstream. This will also
help to backport future patches from the Linux version to our version
(so we can cherry-pick without conflicts).

 Thomas


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Qemu-devel] [PATCH v2 1/5] checkpatch: add a --strict check for utf-8 in commit logs
  2018-04-30 12:46 ` [Qemu-devel] [PATCH v2 1/5] checkpatch: add a --strict check for utf-8 in commit logs Stefan Hajnoczi
@ 2018-05-02  5:32   ` Thomas Huth
  0 siblings, 0 replies; 13+ messages in thread
From: Thomas Huth @ 2018-05-02  5:32 UTC (permalink / raw)
  To: Stefan Hajnoczi, qemu-devel
  Cc: Peter Maydell, Markus Armbruster, Fam Zheng,
	Marc-André Lureau

On 30.04.2018 14:46, Stefan Hajnoczi wrote:
> From: Joe Perches <joe@perches.com>
> 
> Some find using utf-8 in commit logs inappropriate.
> 
> Some patch commit logs contain unintended utf-8 characters when doing
> things like copy/pasting compilation output.
> 
> Look for the start of any commit log by skipping initial lines that look
> like email headers and "From: " lines.
> 
> Stop looking for utf-8 at the first signature line.
> 
> Signed-off-by: Joe Perches <joe@perches.com>
> Suggested-by: Andrew Morton <akpm@linux-foundation.org>
> Cc: Andy Whitcroft <apw@shadowen.org>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
> (cherry picked from commit 15662b3e8644905032c2e26808401a487d4e90c1)
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> 
> Conflicts:
>   QEMU does not have CHK(), use WARN() instead.
> 
>   QEMU WARN() only takes one argument, drop the 'type' value in the
>   first argument.
> ---
>  scripts/checkpatch.pl | 30 ++++++++++++++++++++++++++----
>  1 file changed, 26 insertions(+), 4 deletions(-)

Reviewed-by: Thomas Huth <thuth@redhat.com>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Qemu-devel] [PATCH v2 0/5] checkpatch: backport UTF-8 fixes and MAINTAINERS check
  2018-04-30 12:46 [Qemu-devel] [PATCH v2 0/5] checkpatch: backport UTF-8 fixes and MAINTAINERS check Stefan Hajnoczi
                   ` (5 preceding siblings ...)
  2018-04-30 12:56 ` [Qemu-devel] [PATCH v2 0/5] checkpatch: backport UTF-8 fixes and MAINTAINERS check no-reply
@ 2018-05-02 16:50 ` Markus Armbruster
  2018-05-10  9:42 ` Stefan Hajnoczi
  7 siblings, 0 replies; 13+ messages in thread
From: Markus Armbruster @ 2018-05-02 16:50 UTC (permalink / raw)
  To: Stefan Hajnoczi
  Cc: qemu-devel, Peter Maydell, Thomas Huth, Fam Zheng,
	Marc-André Lureau

Stefan Hajnoczi <stefanha@redhat.com> writes:

> v2:
>  * Resolve missing CHK() [Thomas]
>  * Drop first argument to WARN() to match QEMU function arguments
>
> This series cherry picks checkpatch UTF-8 fixes and the MAINTAINERS file check
> from Linux.  Thomas Huth original did the backport in January 2017 but the
> series was forgotten (<1485436265-12573-1-git-send-email-thuth@redhat.com>).  I
> did the cherry pick again from scratch.
>
> The MAINTAINERS file check prints a warning when new files are added without a
> modification to ./MAINTAINERS.  It is easy to forget to update ./MAINTAINERS
> and this check should help us stay on top of new source files.

The matching is a bit sloppy in places, but if it's good enough for the
kernel...

Series:
Reviewed-by: Markus Armbruster <armbru@redhat.com>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Qemu-devel] [PATCH v2 0/5] checkpatch: backport UTF-8 fixes and MAINTAINERS check
  2018-05-01 13:04   ` Stefan Hajnoczi
  2018-05-02  5:23     ` Thomas Huth
@ 2018-05-03  6:21     ` Fam Zheng
  1 sibling, 0 replies; 13+ messages in thread
From: Fam Zheng @ 2018-05-03  6:21 UTC (permalink / raw)
  To: Stefan Hajnoczi
  Cc: qemu-devel, peter.maydell, thuth, armbru, marcandre.lureau

On Tue, 05/01 14:04, Stefan Hajnoczi wrote:
> On Mon, Apr 30, 2018 at 05:56:30AM -0700, no-reply@patchew.org wrote:
> > === OUTPUT BEGIN ===
> > Checking PATCH 1/5: checkpatch: add a --strict check for utf-8 in commit logs...
> > WARNING: line over 80 characters
> > #101: FILE: scripts/checkpatch.pl:1420:
> > +			WARN("8-bit UTF-8 used in possible commit log\n" . $herecurr);
> > 
> > total: 0 errors, 1 warnings, 66 lines checked
> > 
> > Your patch has style problems, please review.  If any of these errors
> > are false positives report them to the maintainer, see
> > CHECKPATCH in MAINTAINERS.
> > Checking PATCH 2/5: checkpatch: check utf-8 content from a commit log when it's missing from charset...
> > Checking PATCH 3/5: checkpatch: ignore email headers better...
> > Checking PATCH 4/5: checkpatch: emit a warning on file add/move/delete...
> > WARNING: line over 80 characters
> > #46: FILE: scripts/checkpatch.pl:1397:
> > +		     ($line =~ /\{\s*([\w\/\.\-]*)\s*\=\>\s*([\w\/\.\-]*)\s*\}/ &&
> > 
> > ERROR: line over 90 characters
> > #49: FILE: scripts/checkpatch.pl:1400:
> > +			WARN("added, moved or deleted file(s), does MAINTAINERS need updating?\n" . $herecurr);
> > 
> > total: 1 errors, 1 warnings, 24 lines checked
> > 
> > Your patch has style problems, please review.  If any of these errors
> > are false positives report them to the maintainer, see
> > CHECKPATCH in MAINTAINERS.
> > 
> > Checking PATCH 5/5: checkpatch: reduce MAINTAINERS update message frequency...
> > === OUTPUT END ===
> 
> If there are no objections I'd like to keep this in sync with upstream,
> and error messages are exempt from the 80 char limit to aid grepping.

Yeah, I actually like such exceptions for message strings constants in general.

Fam

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Qemu-devel] [PATCH v2 0/5] checkpatch: backport UTF-8 fixes and MAINTAINERS check
  2018-04-30 12:46 [Qemu-devel] [PATCH v2 0/5] checkpatch: backport UTF-8 fixes and MAINTAINERS check Stefan Hajnoczi
                   ` (6 preceding siblings ...)
  2018-05-02 16:50 ` Markus Armbruster
@ 2018-05-10  9:42 ` Stefan Hajnoczi
  7 siblings, 0 replies; 13+ messages in thread
From: Stefan Hajnoczi @ 2018-05-10  9:42 UTC (permalink / raw)
  To: Stefan Hajnoczi
  Cc: qemu-devel, Peter Maydell, Thomas Huth, Fam Zheng,
	Markus Armbruster, Marc-André Lureau

[-- Attachment #1: Type: text/plain, Size: 1335 bytes --]

On Mon, Apr 30, 2018 at 01:46:46PM +0100, Stefan Hajnoczi wrote:
> v2:
>  * Resolve missing CHK() [Thomas]
>  * Drop first argument to WARN() to match QEMU function arguments
> 
> This series cherry picks checkpatch UTF-8 fixes and the MAINTAINERS file check
> from Linux.  Thomas Huth original did the backport in January 2017 but the
> series was forgotten (<1485436265-12573-1-git-send-email-thuth@redhat.com>).  I
> did the cherry pick again from scratch.
> 
> The MAINTAINERS file check prints a warning when new files are added without a
> modification to ./MAINTAINERS.  It is easy to forget to update ./MAINTAINERS
> and this check should help us stay on top of new source files.
> 
> Joe Perches (4):
>   checkpatch: add a --strict check for utf-8 in commit logs
>   checkpatch: ignore email headers better
>   checkpatch: emit a warning on file add/move/delete
>   checkpatch: reduce MAINTAINERS update message frequency
> 
> Pasi Savanainen (1):
>   checkpatch: check utf-8 content from a commit log when it's missing
>     from charset
> 
>  scripts/checkpatch.pl | 56 +++++++++++++++++++++++++++++++++++++++++++++++----
>  1 file changed, 52 insertions(+), 4 deletions(-)
> 
> -- 
> 2.14.3
> 
> 

Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2018-05-10  9:42 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-30 12:46 [Qemu-devel] [PATCH v2 0/5] checkpatch: backport UTF-8 fixes and MAINTAINERS check Stefan Hajnoczi
2018-04-30 12:46 ` [Qemu-devel] [PATCH v2 1/5] checkpatch: add a --strict check for utf-8 in commit logs Stefan Hajnoczi
2018-05-02  5:32   ` Thomas Huth
2018-04-30 12:46 ` [Qemu-devel] [PATCH v2 2/5] checkpatch: check utf-8 content from a commit log when it's missing from charset Stefan Hajnoczi
2018-04-30 12:46 ` [Qemu-devel] [PATCH v2 3/5] checkpatch: ignore email headers better Stefan Hajnoczi
2018-04-30 12:46 ` [Qemu-devel] [PATCH v2 4/5] checkpatch: emit a warning on file add/move/delete Stefan Hajnoczi
2018-04-30 12:46 ` [Qemu-devel] [PATCH v2 5/5] checkpatch: reduce MAINTAINERS update message frequency Stefan Hajnoczi
2018-04-30 12:56 ` [Qemu-devel] [PATCH v2 0/5] checkpatch: backport UTF-8 fixes and MAINTAINERS check no-reply
2018-05-01 13:04   ` Stefan Hajnoczi
2018-05-02  5:23     ` Thomas Huth
2018-05-03  6:21     ` Fam Zheng
2018-05-02 16:50 ` Markus Armbruster
2018-05-10  9:42 ` Stefan Hajnoczi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).