From 647cdd379fef85c390d13b65b07b6c239c654063 Mon Sep 17 00:00:00 2001 From: Mateen Anjum Date: Fri, 22 May 2026 00:52:48 -0400 Subject: [PATCH] ci: harden invisible-unicode check against unusual filenames Use find -type f -print0 with xargs -0 so paths containing whitespace are not split, and only regular files are passed to perl. Signed-off-by: Mateen Anjum --- scripts/check-invisible-unicode.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/check-invisible-unicode.sh b/scripts/check-invisible-unicode.sh index a7d6106a4..d8e42b184 100755 --- a/scripts/check-invisible-unicode.sh +++ b/scripts/check-invisible-unicode.sh @@ -24,7 +24,7 @@ find_files() { -o -wholename '*third_party*' \ \) -prune \ \) \ - \( -name '*.go' -o -name '*.sh' \) + -type f \( -name '*.go' -o -name '*.sh' \) -print0 } # Disallow invisible or bidi Unicode codepoints in source files. These are @@ -35,7 +35,7 @@ find_files() { # U+FEFF byte order mark / zero-width no-break space # U+202A-U+202E bidi explicit formatting # U+2066-U+2069 bidi isolates -matches=$(find_files | xargs perl -CSD -ne ' +matches=$(find_files | xargs -0 perl -CSD -ne ' if (/[\x{200B}-\x{200D}\x{FEFF}\x{202A}-\x{202E}\x{2066}-\x{2069}]/) { chomp; print "$ARGV:$.: $_\n";