git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: b4: unicode control characters -- warn or remove?

From
Konstantin Ryabitsev <konstantin@linuxfoundation.org>
Date
Nov 2, 2021, 14:09 UTC
Message-ID
<20211102140907.d7turl5zhaxkcp7w@meerkat.local>
In-Reply-To
<20211101202220.dlcebvckeoz6c26k@meerkat.local>
On Mon, Nov 01, 2021 at 04:22:20PM -0400, Konstantin Ryabitsev wrote:
Show 7 quoted lines
> I think the following would be a sane check:
> 
> 1. are there unicode control characters (CCs) present?
> 2. are there other characters from RTL languages present in the same line?
> 
> if both 1 && 2 are true, this is a legitimate use of Unicode CCs. If only 1 is
> true, then it's likely worth a warning.

I implemented this solution in b4 master, so it should error out only when it finds control characters without any "other letter" unicode character category present in the same line (where Hebrew, Arabic, etc live). There's probably still a way to take advantage of this, but hopefully it's a lot less trivial now and less likely to go unnoticed by the reviewer.

The error message will point where it found the problem:
	WARNING: Message contains suspicious unicode control characters!
			 Subject: [PATCH 1/2] SPI: Add SPI driver for Sunplus SP7021
				Line: + /* ‮ } ⁦if (isAdmin)⁩ ⁦ begin admins only */
				-----------^
				Char: RIGHT-TO-LEFT OVERRIDE (0x202e)
			 If you are sure about this, rerun with the right flag to allow.
One can rerun with --allow-unicode-control-chars to override this.
-K
Previous: Konstantin Ryabitsev
Message 7 of 7 in “Re: b4: unicode control characters -- warn or remove?”
  1. Eric WongNov 1, 2021
  2. Konstantin RyabitsevNov 1, 2021
  3. Ævar Arnfjörð BjarmasonNov 1, 2021
  4. Konstantin RyabitsevNov 1, 2021
  5. Pavel MachekNov 1, 2021
  6. Konstantin RyabitsevNov 1, 2021
  7. Konstantin RyabitsevNov 2, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.