Reject explicit bidirectional controls in tracked sources #274
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/278"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-21T20:09:58Z.
Change
Fixes #254, with the scope set there.
tests/bidi_controls_check.pyfails on the explicit bidirectional controls in Git-tracked source files, scripts and build/CI configuration. These are the embeddings and overrides U+202A to U+202E and the isolates U+2066 to U+2069. Each finding printspath:line: U+XXXX NAME. The check runs in the existingpython-linuxjob and uses the standard library only.In scope:
.asm .c .cc .cpp .cxx .def .h .hh .hlsl .hlsli .hpp .inc .inl .py;.bat .cmd .ps1 .psm1 .sh .cmake;CMakeLists.txt,CMakePresets.json,requirements-dev.txtand.gitattributes;.yml/.yamlfiles under.github/.Out of scope, as requested: Markdown and other documentation, zero-width characters, UTF-8 enforcement and a binary allowlist. Files are decoded as UTF-8 with replacement, so a non-UTF-8 file is still scanned and never fails for its encoding. Lines are counted on LF only, so CRLF files and form feeds report the same line an editor shows.
Verification
On
17e7381(branch on496fc28), Windows 11 build 26300, Python 3.14:The self-test runs first on every invocation. It writes synthetic files, byte for byte, into a temporary directory:
tools/hidden.py:2: U+202E RIGHT-TO-LEFT OVERRIDE;tests/isolate.cpp:2: U+2066 LEFT-TO-RIGHT ISOLATE;.github/workflows/ci.yml:1: U+202E RIGHT-TO-LEFT OVERRIDE;64×64,café,naïve,–,≡), which passes;It also asserts that the set holds exactly the nine code points.
Negative controls, run by hand and reverted:
tools/pe_inventory.pyprintstools/pe_inventory.py:1: U+202E RIGHT-TO-LEFT OVERRIDEand exits 1.docs/experiments.mdis not reported..mdto the suffixes;splitlines(), which reports line 3 for the CRLF file.Evidence and follow-up
The script contains no literal control characters; the self-test builds them with
chr().Checklist
AI-assisted.