Linux XFS filesystem development
 help / color / mirror / Atom feed
* [PATCH] xfs_scrub: drop the warning about mixed bidirectional codepoints in names
@ 2026-05-04 17:08 Darrick J. Wong
  2026-05-05 11:28 ` Andrey Albershteyn
  2026-05-07  5:35 ` Christoph Hellwig
  0 siblings, 2 replies; 3+ messages in thread
From: Darrick J. Wong @ 2026-05-04 17:08 UTC (permalink / raw)
  To: Gedalya, Andrey Albershteyn; +Cc: linux-xfs

From: Darrick J. Wong <djwong@kernel.org>

Gedalya complained about receiving warnings about mixed bidirectional
codepoints in a filename:

"First, well-known file name extensions are not internationalized. While
the file name can be in non-latin letters, the extension will be in
latin. Hence you would expect to see file names such as עברית.pdf ."

Gedalya goes on to point out that file names can be created from (say)
the title of an article, which might itself mix RTL and LTR characters.
Both uses are totally fair, but regrettably unfamiliar to 2018-era me.

Unicode TR 36 even weasel-words its own recommendation: "As much as
possible, avoid mixing right-to-left and left-to-right characters in a
single name."  Maybe I should have paid more attention to weasel
wording in specifications. :P

Let's fix this by removing the warning altogether.

Reported-by: gedalya@gedalya.net
Link: https://lore.kernel.org/linux-xfs/8961ee4a-3830-498b-a432-5545695db599@gedalya.net/
Link: https://www.unicode.org/reports/tr36/tr36-15.html#Bidirectional_Text_Spoofing
Cc: <linux-xfs@vger.kernel.org> # v4.16.0
Fixes: baa9ed8dca213f ("xfs_scrub: check name for suspicious characters")
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
 scrub/unicrash.c |   29 +++++------------------------
 1 file changed, 5 insertions(+), 24 deletions(-)

diff --git a/scrub/unicrash.c b/scrub/unicrash.c
index 75493c5ee795da..87c0a8f0542fbb 100644
--- a/scrub/unicrash.c
+++ b/scrub/unicrash.c
@@ -112,23 +112,20 @@ struct unicrash {
 /* Name contains directional overrides. */
 #define UNICRASH_BIDI_OVERRIDE	((__force badname_t)(1U << 1))
 
-/* Name mixes left-to-right and right-to-left characters. */
-#define UNICRASH_BIDI_MIXED	((__force badname_t)(1U << 2))
-
 /* Control characters in name. */
-#define UNICRASH_CONTROL_CHAR	((__force badname_t)(1U << 3))
+#define UNICRASH_CONTROL_CHAR	((__force badname_t)(1U << 2))
 
 /* Invisible characters.  Only a problem if we have collisions. */
-#define UNICRASH_INVISIBLE	((__force badname_t)(1U << 4))
+#define UNICRASH_INVISIBLE	((__force badname_t)(1U << 3))
 
 /* Multiple names resolve to the same skeleton string. */
-#define UNICRASH_CONFUSABLE	((__force badname_t)(1U << 5))
+#define UNICRASH_CONFUSABLE	((__force badname_t)(1U << 4))
 
 /* Possible phony file extension. */
-#define UNICRASH_PHONY_EXTENSION ((__force badname_t)(1U << 6))
+#define UNICRASH_PHONY_EXTENSION ((__force badname_t)(1U << 5))
 
 /* More than one variation selector in a row. */
-#define UNICRASH_VARIATION_RUN	((__force badname_t)(1U << 7))
+#define UNICRASH_VARIATION_RUN	((__force badname_t)(1U << 6))
 
 /* FULL STOP (aka period), 0x2E */
 #define UCHAR_PERIOD		((UChar32)'.')
@@ -549,9 +546,6 @@ name_entry_examine(
 		was_variation = is_variation;
 	}
 
-	/* mixing left-to-right and right-to-left chars */
-	if (mask == 0x3)
-		ret |= UNICRASH_BIDI_MIXED;
 	return ret;
 }
 
@@ -869,19 +863,6 @@ _("Unicode name \"%s\" in %s contains a weird sequence of variation selectors.")
 	if (!verbose && (uc->is_only_root_writeable || entry->namelen < 4))
 		goto out;
 
-	/*
-	 * It's not considered good practice (says Unicode) to mix LTR
-	 * characters with RTL characters.  The mere presence of different
-	 * bidirectional characters isn't enough to trip up software, so don't
-	 * warn about this too loudly.
-	 */
-	if (badflags & UNICRASH_BIDI_MIXED) {
-		str_info(uc->ctx, descr_render(dsc),
-_("Unicode name \"%s\" in %s mixes bidirectional characters."),
-				bad1, what);
-		goto out;
-	}
-
 	/*
 	 * We'll note if two names could be confusable with each other, but
 	 * whether or not the user will actually confuse them is dependent

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] xfs_scrub: drop the warning about mixed bidirectional codepoints in names
  2026-05-04 17:08 [PATCH] xfs_scrub: drop the warning about mixed bidirectional codepoints in names Darrick J. Wong
@ 2026-05-05 11:28 ` Andrey Albershteyn
  2026-05-07  5:35 ` Christoph Hellwig
  1 sibling, 0 replies; 3+ messages in thread
From: Andrey Albershteyn @ 2026-05-05 11:28 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: Gedalya, linux-xfs

On 2026-05-04 10:08:52, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> Gedalya complained about receiving warnings about mixed bidirectional
> codepoints in a filename:
> 
> "First, well-known file name extensions are not internationalized. While
> the file name can be in non-latin letters, the extension will be in
> latin. Hence you would expect to see file names such as עברית.pdf ."
> 
> Gedalya goes on to point out that file names can be created from (say)
> the title of an article, which might itself mix RTL and LTR characters.
> Both uses are totally fair, but regrettably unfamiliar to 2018-era me.
> 
> Unicode TR 36 even weasel-words its own recommendation: "As much as
> possible, avoid mixing right-to-left and left-to-right characters in a
> single name."  Maybe I should have paid more attention to weasel
> wording in specifications. :P
> 
> Let's fix this by removing the warning altogether.
> 
> Reported-by: gedalya@gedalya.net
> Link: https://lore.kernel.org/linux-xfs/8961ee4a-3830-498b-a432-5545695db599@gedalya.net/
> Link: https://www.unicode.org/reports/tr36/tr36-15.html#Bidirectional_Text_Spoofing
> Cc: <linux-xfs@vger.kernel.org> # v4.16.0
> Fixes: baa9ed8dca213f ("xfs_scrub: check name for suspicious characters")
> Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>

lgtm
Reviewed-by: Andrey Albershteyn <aalbersh@kernel.org>

-- 
- Andrey


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] xfs_scrub: drop the warning about mixed bidirectional codepoints in names
  2026-05-04 17:08 [PATCH] xfs_scrub: drop the warning about mixed bidirectional codepoints in names Darrick J. Wong
  2026-05-05 11:28 ` Andrey Albershteyn
@ 2026-05-07  5:35 ` Christoph Hellwig
  1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2026-05-07  5:35 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: Gedalya, Andrey Albershteyn, linux-xfs

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-05-07  5:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-04 17:08 [PATCH] xfs_scrub: drop the warning about mixed bidirectional codepoints in names Darrick J. Wong
2026-05-05 11:28 ` Andrey Albershteyn
2026-05-07  5:35 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox