Skip to contentSkip to conversation

checkpatch: Add support for long UTF-8 name

PATCH In review Kory Maincent 1 participant 2 messages Nov 28, 2025 – Jan 5 Checkpatch

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 checkpatch: Add support for long UTF-8 name

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?= <[email protected]>
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?=" <[email protected]>' != 'Signed-off-by: Köry Maincent (bla blou prout test test) <[email protected]>'

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

---
 scripts/checkpatch.pl | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
scripts/checkpatch.pl +4 -2
index 92669904eecc7..98cc7f6fb8b5f 100755
@@ -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);
 		}
Signature · 1 line
2.43.0
#1 lore raw
Quoted 16 lines · On Fri, 28 Nov 2025 11:26:22 +0100 Kory Maincent <[email protected]>…

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?= <[email protected]>
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?=" <[email protected]>' != 'Signed-off-by: Köry Maincent (bla blou prout test test) <[email protected]>'

Quoted 2 lines

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

Hello,

Any news on this? I know it fixes a rare case but still, the issue is present.

Regards,

Signature · 3 lines
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com