mirror of
https://github.com/Homebrew/BrewUI.git
synced 2026-10-02 00:24:33 +08:00
The crash in #234 was an AppKit exception that our own signal handler then turned into a 20,000-frame stack overflow: `_crashOnException:` raises SIGTRAP, Darwin does not honour SA_RESETHAND for SIGTRAP or SIGILL, so the handler's re-raise re-entered it until the stack guard page was hit, appending a backtrace to the report on every pass. The 82 MB report that motivated the 16 KB clamp came from the same loop. Async-signal-safe code is the wrong place to keep finding bugs when macOS already writes a better report for every crash, including the ones a handler cannot see. The controller now reads the reports macOS wrote since the one the user last acknowledged, and discarding records that time rather than deleting the file, which the issue body asks the user to attach when truncated. Under `-uiTesting` it reads an empty directory in the run's container with a prefixed defaults key, so a crash on the host machine cannot open the sheet mid-test. Verified on a Debug build: `kill -TRAP` terminates at once, no report directory is created under Application Support, and the sheet appears on the next launch with the report ReportCrash wrote. Closes #234. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>