mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kory Maincent <kory.maincent@bootlin.com>
To: linux-kernel@vger.kernel.org
Cc: "Kory Maincent" <kory.maincent@bootlin.com>,
	"Jérémie Dautheribes" <jeremie.dautheribes@bootlin.com>,
	"Louis Chauvet" <louis.chauvet@bootlin.com>,
	thomas.petazzoni@bootlin.com,
	"Andy Whitcroft" <apw@canonical.com>,
	"Joe Perches" <joe@perches.com>,
	"Dwaipayan Ray" <dwaipayanray1@gmail.com>,
	"Lukas Bulwahn" <lukas.bulwahn@gmail.com>
Subject: [PATCH] checkpatch: Add support for long UTF-8 name
Date: Fri, 28 Nov 2025 11:26:22 +0100	[thread overview]
Message-ID: <20251128102623.645512-1-kory.maincent@bootlin.com> (raw)

In case we have a long utf-8 name the second line will contain UTF-8
code.

Here is an example:
  From: =?UTF-8?q?K=C3=B6ry=20Maincent=20=28bla=20blou=20prout=20test=20?=
   =?UTF-8?q?=29?= <kory.maincent@bootlin.com>
  Date: Fri, 28 Nov 2025 10:57:00 +0100
  Subject: [PATCH] checkpatch: Add support for long UTF-8 name

On this rare case checkpatch is returning an error due to UTF-8 code in
the name as it only decodes the From once the line is fully concatenated.
  WARNING: From:/Signed-off-by: email name mismatch: 'From: "Köry Maincent
  (bla blou prout test test=?UTF-8?q?=29?=" <kory.maincent@bootlin.com>'
  != 'Signed-off-by: Köry Maincent (bla blou prout test test)
  <kory.maincent@bootlin.com>'

Decode each line instead to be sure we don't have UTF-8 code in the
email name check.

Reported-by: Jérémie Dautheribes <jeremie.dautheribes@bootlin.com>
Co-developed-by: Louis Chauvet <louis.chauvet@bootlin.com>
Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>
Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
---
 scripts/checkpatch.pl | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 92669904eecc7..98cc7f6fb8b5f 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2979,11 +2979,13 @@ sub process {
 # Check the patch for a From:
 		if (decode("MIME-Header", $line) =~ /^From:\s*(.*)/) {
 			$author = $1;
+			$author = encode("utf8", $author) if ($line =~ /=\?utf-8\?/i);
 			my $curline = $linenr;
 			while(defined($rawlines[$curline]) && ($rawlines[$curline++] =~ /^[ \t]\s*(.*)/)) {
-				$author .= $1;
+				my $tmp = $1;
+				$tmp = encode("utf8", decode("MIME-Header", $tmp)) if ($tmp =~ /=\?utf-8\?/i);
+				$author .= $tmp;
 			}
-			$author = encode("utf8", $author) if ($line =~ /=\?utf-8\?/i);
 			$author =~ s/"//g;
 			$author = reformat_email($author);
 		}
-- 
2.43.0


             reply	other threads:[~2025-11-28 10:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-28 10:26 Kory Maincent [this message]
2026-01-05 13:16 ` Kory Maincent

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=20251128102623.645512-1-kory.maincent@bootlin.com \
    --to=kory.maincent@bootlin.com \
    --cc=apw@canonical.com \
    --cc=dwaipayanray1@gmail.com \
    --cc=jeremie.dautheribes@bootlin.com \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=louis.chauvet@bootlin.com \
    --cc=lukas.bulwahn@gmail.com \
    --cc=thomas.petazzoni@bootlin.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

all inboxes | Powered by JetHome®