qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>, qemu-devel@nongnu.org
Cc: "Marc-André Lureau" <marcandre.lureau@gmail.com>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Fam Zheng" <famz@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 2/5] checkpatch: check utf-8 content from a commit log when it's missing from charset
Date: Thu, 19 Apr 2018 12:12:06 +0200	[thread overview]
Message-ID: <369f09c1-bfa5-ff7e-d4f7-906b1c7f7098@redhat.com> (raw)
In-Reply-To: <20180419091105.3943-3-stefanha@redhat.com>

On 19.04.2018 11:11, Stefan Hajnoczi wrote:
> 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>
> ---
>  scripts/checkpatch.pl | 15 ++++++++++++---
>  1 file changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 2d28db03a0..b2b088bab7 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -1185,6 +1185,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;
> @@ -1413,10 +1415,17 @@ 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="(.+)".*$/ &&

In my version of the patch, I removed the quotes:

https://patchwork.kernel.org/patch/9539231/

... but I guess I should likely follow up on that change with the kernel
folks first ...


> +		    $1 !~ /utf-8/i) {
> +			$non_utf8_charset = 1;
> +		}
> +
> +		if ($in_commit_log && $non_utf8_charset && $realfile =~ /^$/ &&
>  		    $rawline =~ /$NON_ASCII_UTF8/) {
> -			CHK("UTF8_BEFORE_PATCH",
> +			WARN("UTF8_BEFORE_PATCH",
>  			    "8-bit UTF-8 used in possible commit log\n" . $herecurr);

Ah, here's the WARN instead of CHK ... in case you respin, you should do
that in the first patch already, I think.

In either case:

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

  reply	other threads:[~2018-04-19 10:12 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-19  9:11 [Qemu-devel] [PATCH 0/5] checkpatch: backport UTF-8 fixes and MAINTAINERS check Stefan Hajnoczi
2018-04-19  9:11 ` [Qemu-devel] [PATCH 1/5] checkpatch: add a --strict check for utf-8 in commit logs Stefan Hajnoczi
2018-04-19 10:04   ` Thomas Huth
2018-04-19  9:11 ` [Qemu-devel] [PATCH 2/5] checkpatch: check utf-8 content from a commit log when it's missing from charset Stefan Hajnoczi
2018-04-19 10:12   ` Thomas Huth [this message]
2018-04-19  9:11 ` [Qemu-devel] [PATCH 3/5] checkpatch: ignore email headers better Stefan Hajnoczi
2018-04-19 10:14   ` Thomas Huth
2018-04-19  9:11 ` [Qemu-devel] [PATCH 4/5] checkpatch: emit a warning on file add/move/delete Stefan Hajnoczi
2018-04-19 10:15   ` Thomas Huth
2018-04-19  9:11 ` [Qemu-devel] [PATCH 5/5] checkpatch: reduce MAINTAINERS update message frequency Stefan Hajnoczi
2018-04-19 10:16   ` Thomas Huth
2018-04-19  9:21 ` [Qemu-devel] [PATCH 0/5] checkpatch: backport UTF-8 fixes and MAINTAINERS check no-reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=369f09c1-bfa5-ff7e-d4f7-906b1c7f7098@redhat.com \
    --to=thuth@redhat.com \
    --cc=armbru@redhat.com \
    --cc=famz@redhat.com \
    --cc=marcandre.lureau@gmail.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).