From: Joe Perches <joe@perches.com>
To: Antonio Borneo <antonio.borneo@foss.st.com>,
Andy Whitcroft <apw@canonical.com>,
Dwaipayan Ray <dwaipayanray1@gmail.com>,
Lukas Bulwahn <lukas.bulwahn@gmail.com>,
linux-kernel@vger.kernel.org
Cc: Andrew Morton <akpm@linux-foundation.org>,
Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH] checkpatch: handle utf8 while computing length of commit msg lines
Date: Fri, 21 Oct 2022 22:48:20 -0700 [thread overview]
Message-ID: <b086dff1295732ad412b4de2f363e75a42bb6069.camel@perches.com> (raw)
In-Reply-To: <20221021191507.9026-1-antonio.borneo@foss.st.com>
On Fri, 2022-10-21 at 21:15 +0200, Antonio Borneo wrote:
> The current check for the length of each line in the commit msg
> uses length($line) that counts line's bytes.
> If the line contains utf8 characters, the byte count can exceed
> the cap even on quite short lines.
>
> Count the utf8 characters for checking line length.
>
> Signed-off-by: Antonio Borneo <antonio.borneo@foss.st.com>
>
> ---
>
> Actually it's not fully clear to me if utf8 characters in the
> commit msg are acceptable/tolerated or to be avoided.
Nor is it to me, likely it's OK though as at least checkpatch has an
existing test/comment for nominally valid UTF-8 in commit messages.
CHK("INVALID_UTF8",
"Invalid UTF-8, patch and commit message should be encoded in UTF-8\n" . $hereptr);
> In the commit msg of 15662b3e8644 ("checkpatch: add a --strict
> check for utf-8 in commit logs") is stated:
> Some find using utf-8 in commit logs inappropriate.
I don't particularly care one way or another.
Andrew? Linus?
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 1e5e66ae5a52..eaad5da50554 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -3220,7 +3220,7 @@ sub process {
>
> # Check for line lengths > 75 in commit log, warn once
> if ($in_commit_log && !$commit_log_long_line &&
> - length($line) > 75 &&
> + length(decode("utf8", $line)) > 75 &&
> !($line =~ /^\s*[a-zA-Z0-9_\/\.]+\s+\|\s+\d+/ ||
> # file delta changes
> $line =~ /^\s*(?:[\w\.\-\+]*\/)++[\w\.\-\+]+:/ ||
>
> base-commit: 9abf2313adc1ca1b6180c508c25f22f9395cc780
next prev parent reply other threads:[~2022-10-22 5:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-21 19:15 Antonio Borneo
2022-10-22 5:48 ` Joe Perches [this message]
2022-10-22 18:33 ` Linus Torvalds
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=b086dff1295732ad412b4de2f363e75a42bb6069.camel@perches.com \
--to=joe@perches.com \
--cc=akpm@linux-foundation.org \
--cc=antonio.borneo@foss.st.com \
--cc=apw@canonical.com \
--cc=dwaipayanray1@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lukas.bulwahn@gmail.com \
--cc=torvalds@linux-foundation.org \
/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®