Repository navigation
fix(rust): read rustc commit paths written with a Windows separator - #9542
Conversation
[Medium impact] The PR appears safe to merge. SummaryAccepts a backslash after
No actionable issues found. The supplied target commit still requires a forward slash, so this fix is not already present there. Checking for a superseding PR was blocked by unavailable GitHub authentication. Tests were not run during this review. Reviews (3) · Last reviewed commit: "Merge branch 'main' into rrfz/read-rustc..." · Reviewed by Greptile |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Summary
inspect-rust-binaryfinds the rustc commit by scanning read-only data for/rustc/<40-hex>/. Windows builds join the rest of that path with a backslash:lightningcss.win32-x64-msvc.nodestores/rustc/ded5c06cf21d2b93bffd5d884aa6e96934ee4234\library\core\src\.... REA required the byte after the hash to be/, so it reported no commit for these binaries. It now also accepts\after the hash. The prefix and the 40 lowercase hex digits are unchanged.No issue is linked. I found this by comparing REA with a byte scan of the Rust binaries on a Windows machine.
Problem and expected behavior
On main
a93eb3969, Windows 11:rea inspect-rust-binary <lightningcss-win32-x64-msvc 1.33.0>/lightningcss.win32-x64-msvc.node --jsonreturnsrustc_commit: nulland the limitation "No /rustc/<40-hex>/ path was found in read-only data". The file holds 16 copies of/rustc/ded5c06c…\library\…. That hash is a rust-lang/rust stable-branch merge commit (2025-12-08).C:\Windows\System32\sudo.exebehaves the same way.Expected: a backslash after the hash is read as the same path, and the hash is reported with its file offset.
Change and scope
src/rust/RustBinaryImage.ts:hashAtaccepts/or\after the 40 hex digits.docs/rust-binaries.md: one sentence on the Windows form.Scope decision: not applicable. This is an ordinary fix within the existing Rust inspection.
Contract and boundary impact
RustBinaryImagecompiler-path search. Nothing else changes.rustc_commitis now populated for Windows-built binaries that were reported as having none./are unchanged.evidence_kind: "inferred"with the same limitation text.docs/public/product-catalog.json), package, or installation impact: none committed.Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.
Evidence and regression coverage
Tests added or updated: one
it.eachintests/boundary/rust/rustBinaryImage.test.ts, after the existing ELF/PE hash test. It rewrites the byte after the fixture hash.\: the hash is read at offset 2048.-: no hash, so the check stays limited to path separators.Base reproduction: with main's
RustBinaryImage.ts, the file gives 1 failed, 37 passed (the\row). With this change: 38 passed.Real binaries: I scanned 21,275 PE files on this machine (System32, SysWOW64, Program Files, node_modules) for
/rustc/<40-hex>followed by any byte. 37 contain such a path./after the hash. Main reports their one hash.\. Main reports no hash for all 19. Examples:sudo.exe, severalDWriteCore.dllcopies,rollup.win32-x64-msvc.node,jscpd.exe,tree-sitter.exe.User-visible CLI output for
lightningcss.win32-x64-msvc.node:Before:
"rustc_commit": null, with "No /rustc/<40-hex>/ path was found in read-only data, so a rustc commit hash is unknown."After:
Remaining proof gaps: Linux CI has not run yet. I did not check Windows-built ELF or Mach-O files; the change covers them through the same function.
Boundary regressions: artifact parsing of compiler-path strings. Lifecycle regressions: not applicable.
For evidence-bearing changes:
The hash stays inferred. Several distinct hashes still leave the commit unknown.
Validation performed
Windows 11, Node.js 24.22.1, base
a93eb3969.c78c8aed4:npx vitest run tests/boundary/rust/rustBinaryImage.test.tsgives 1 failed, 37 passed with main'sRustBinaryImage.ts, and 38 passed with this change.npm run check:fastpassed.npm run test:focused -- tests/boundary/rust/rustBinaryImage.test.ts: 38 passed. With main'sRustBinaryImage.ts: 1 failed, 37 passed.npm run check:fast: passed.npx oxfmton the three changed files.lightningcss.win32-x64-msvc.nodeandC:\Windows\System32\sudo.exe, before and after, each afternpm run build:cached.git merge-treeonc78c8aed4with the open PRs that touch these files (fix(rust): report consumed-stream inflate limit for padded PE sections #9232, feat(audit): report what a shipped app exposes to static analysis #8525, feat(evidence): project Go and Rust dependencies as CycloneDX #8445, fix(artifacts): retain completed Rust, BEAM, and pyc facts through finalization #6942, feat(rust): read cargo-auditable dependencies from WebAssembly modules #5069): no new conflicts. fix(artifacts): retain completed Rust, BEAM, and pyc facts through finalization #6942 and feat(rust): read cargo-auditable dependencies from WebAssembly modules #5069 already conflict with main on their own.Compatibility, safety, and release
Author readiness
Human owner: @Plastic-time
Before merge
type(scope): outcome.