[GH-ISSUE #187] native: make inspect_macho resilient when vtool is unavailable #134

Closed
opened 2026-10-15 18:21:28 +00:00 by bsakaguchi · 0 comments
Owner

Originally created by @morluto on GitHub (Jul 14, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/187

Problem

inspectNativeMacho currently aborts the whole native Mach-O inspection if any command in its fixed command list fails.

The native Mach-O command list is:

  • file -b
  • lipo -detailed_info
  • otool -l
  • nm -gjU
  • dyld_info -imports
  • dyld_info -exports
  • dwarfdump --uuid
  • vtool -show-build

The normalized schema does not require vtool output (src/native/NativeMachoInspection.ts:88-92); vtool is currently only retained as provenance.

If vtool is missing from the resolved xcrun toolchain (for example in partial CLI setups), inspect_macho fails with a capability/adapter error even though the rest of the analysis commands are available.

Evidence

  • Early-return on any command failure: if (!captured.ok) return err(captured.error) in inspectNativeMacho (src/native/NativeMachoInspection.ts:57).
  • vtool result is used only for provenance text, not required schema fields (src/native/NativeMachoInspection.ts:91).

Reproduction

  1. Run native Mach-O inspection on an environment where xcrun --find vtool fails.
  2. Observe inspect_macho fails despite other required tools being present.

Expected

inspect_macho should degrade gracefully when optional tools are unavailable:

  • keep the best-effort Mach-O result from required commands
  • add a limitation explaining that vtool was unavailable
  • include provenance for attempted commands

Impact

This blocks Mach-O inspection on valid environments with partial Xcode toolchains.

Suggested fix

Split Mach-O command execution into required and optional groups. Treat vtool as optional and convert its failure into a non-fatal limitation.

Originally created by @morluto on GitHub (Jul 14, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/187 ## Problem `inspectNativeMacho` currently aborts the whole native Mach-O inspection if any command in its fixed command list fails. The native Mach-O command list is: - `file -b` - `lipo -detailed_info` - `otool -l` - `nm -gjU` - `dyld_info -imports` - `dyld_info -exports` - `dwarfdump --uuid` - `vtool -show-build` The normalized schema does not require vtool output (`src/native/NativeMachoInspection.ts:88-92`); vtool is currently only retained as provenance. If `vtool` is missing from the resolved xcrun toolchain (for example in partial CLI setups), `inspect_macho` fails with a capability/adapter error even though the rest of the analysis commands are available. ## Evidence - Early-return on any command failure: `if (!captured.ok) return err(captured.error)` in `inspectNativeMacho` (`src/native/NativeMachoInspection.ts:57`). - `vtool` result is used only for provenance text, not required schema fields (`src/native/NativeMachoInspection.ts:91`). ## Reproduction 1. Run native Mach-O inspection on an environment where `xcrun --find vtool` fails. 2. Observe `inspect_macho` fails despite other required tools being present. ## Expected `inspect_macho` should degrade gracefully when optional tools are unavailable: - keep the best-effort Mach-O result from required commands - add a limitation explaining that vtool was unavailable - include provenance for attempted commands ## Impact This blocks Mach-O inspection on valid environments with partial Xcode toolchains. ## Suggested fix Split Mach-O command execution into required and optional groups. Treat `vtool` as optional and convert its failure into a non-fatal limitation.
bsakaguchi 2026-10-15 18:21:28 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#134
No description provided.