Skip to content

fix(rust): read rustc commit paths written with a Windows separator - #9192

Closed
Plastic-time wants to merge 1 commit into
morluto:mainfrom
Plastic-time:rrfz/rustc-windows-path-commit
Closed

Plastic-time wants to merge 1 commit into
morluto:mainfrom
Plastic-time:rrfz/rustc-windows-path-commit

Conversation

@Plastic-time

@Plastic-time Plastic-time commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

inspect-rust-binary finds 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.node stores /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 --json returns rustc_commit: null and 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.exe behaves 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: hashAt accepts / 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

  • Semantic owner and earliest changed stage: RustBinaryImage compiler-path search. Nothing else changes.
  • Contribution scope fit and linked maintainer decision: ordinary fix; not applicable.
  • CLI and MCP/tool-catalog contract: no schema change. rustc_commit is now populated for Windows-built binaries that were reported as having none.
  • Provider, bridge, target-format, or platform compatibility: PE, ELF and Mach-O go through the same search. Builds that write / are unchanged.
  • Evidence, artifact, provenance, or reconstruction contract: the hash stays evidence_kind: "inferred" with the same limitation text.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): not applicable.
  • Generated metadata (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.

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated: one it.each in tests/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.

    • 18 use / after the hash. Main reports their one hash.
    • 19 use only \. Main reports no hash for all 19. Examples: sudo.exe, several DWriteCore.dll copies, rollup.win32-x64-msvc.node, jscpd.exe, tree-sitter.exe.
    • With this change, all 37 report exactly the hash the byte scan found.
  • 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:

    "rustc_commit": {"evidence_kind": "inferred", "hashes": [{"hash": "ded5c06cf21d2b93bffd5d884aa6e96934ee4234", "file_offset": 8702328}]}
  • 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:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

The hash stays inferred. Several distinct hashes still leave the commit unknown.

Validation performed

Windows 11, Node.js 24.22.1, base a93eb3969.

Compatibility, safety, and release

  • Breaking changes or migration steps: none. Reports that had no hash can now carry one.
  • Real Hopper/Ghidra, browser, or OS coverage: Windows 11 only.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: read-only parsing; no new effects.

Author readiness

Human owner: @Plastic-time

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-06T21:28:29.397181Z
We couldn’t complete this review. Comment @codex review to try again.
eb961ee PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@greptile-apps

greptile-apps Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The code appears safe to merge; no actionable defects were found.

Summary

Accepts a backslash after an embedded rustc commit hash, so Windows-built binaries can report the hash and its file offset.

  • Rust binary inspection now finds hashes in Windows-style paths.

Reviews (1) · Last reviewed commit: "fix(rust): read rustc commit paths writt..." · Reviewed by Greptile

@morluto morluto added bug Something isn't working provider: rust Analysis provider / engine: rust labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working provider: rust Analysis provider / engine: rust

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants