Skip to content

fix: make strip failure non-fatal for cross-compilation#21

Merged
BYK merged 1 commit into
mainfrom
fix/strip-cross-compile-fatal
May 29, 2026
Merged

fix: make strip failure non-fatal for cross-compilation#21
BYK merged 1 commit into
mainfrom
fix/strip-cross-compile-fatal

Conversation

@BYK
Copy link
Copy Markdown
Owner

@BYK BYK commented May 29, 2026

Problem

Cross-compiling (e.g., linux-arm64 on x86_64 host) crashes fossilize because strip fails with exit code 1 ("Unable to recognise the format of the input file") and the run() helper calls process.exit(1) for numeric error codes — bypassing the try/catch that was supposed to make it non-fatal.

Root cause

run() (line 44) has two failure paths:

  • Numeric exit code → process.exit(code) (kills the process, uncatchable)
  • Non-numeric error → throw new Error(...) (caught by try/catch)

strip returns exit code 1, so process.exit(1) fires. The catch block on line 248 ("Warning: strip failed... (non-fatal)") never executes.

Fix

Replace run() with execFileAsync directly for the strip call. The error is now properly caught, a warning is printed, and fossilize continues with an unstripped binary.

This was always the intended behavior (the comment says "Non-fatal: may fail when cross-stripping") — it just never worked because of the process.exit() escape hatch in run().

The run() helper calls process.exit() on numeric error codes, which
bypasses the try/catch around the strip call. When cross-compiling
(e.g., ARM64 binary on x86_64 host), strip fails with exit code 1
('Unable to recognise the format'), killing the entire fossilize
process instead of continuing with an unstripped binary.

Fix: use execFileAsync directly instead of run() so the error is
properly caught and treated as non-fatal.
@BYK BYK merged commit b94caca into main May 29, 2026
5 checks passed
@BYK BYK deleted the fix/strip-cross-compile-fatal branch May 29, 2026 22:43
BYK added a commit to getsentry/cli that referenced this pull request May 29, 2026
Updates fossilize to 0.8.1 which fixes a bug where `strip` failure on
cross-compiled binaries (e.g., linux-arm64 on x86_64 host) called
`process.exit()` instead of falling through as non-fatal.

This was a pre-existing issue that predates #1037 — the `run()` helper
in fossilize has always called `process.exit()` for numeric error codes,
bypassing the try/catch. The fix uses `execFileAsync` directly so the
error is properly caught and treated as non-fatal (prints a warning and
continues with an unstripped binary).

Upstream: [BYK/fossilize#21](BYK/fossilize#21)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant