Skip to content

(release/25.2) xquartz: Replace assert() around side-effecting calls with unconditional error handling - #3575

Open
metux wants to merge 1 commit into
release/25.2from
pr/release/25.2-xquartz-replace-assert-around-side-effecting-calls-with-unconditional-error-handling-_2026-08-20_15-44-17
Open

(release/25.2) xquartz: Replace assert() around side-effecting calls with unconditional error handling#3575
metux wants to merge 1 commit into
release/25.2from
pr/release/25.2-xquartz-replace-assert-around-side-effecting-calls-with-unconditional-error-handling-_2026-08-20_15-44-17

Conversation

@metux

@metux metux commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

darwin.c and bundle_trampoline.c wrapped calls that allocate memory, add input devices, or spawn a process in
assert(), so building with NDEBUG would silently skip the call and leave the guarded variable uninitialized or
unset while still proceeding as if it had succeeded.

darwin.c now calls FatalError() on failure. bundle_trampoline runs before the server attaches to a terminal or
console, so stderr is not visible there; it now logs via os_log_error() and calls abort().

Signed-off-by: Jeremy Huddleston Sequoia jeremyhu@apple.com

…nal error handling

darwin.c and bundle_trampoline.c wrapped calls that allocate memory, add input devices, or spawn a process in
assert(), so building with NDEBUG would silently skip the call and leave the guarded variable uninitialized or
unset while still proceeding as if it had succeeded.

darwin.c now calls FatalError() on failure. bundle_trampoline runs before the server attaches to a terminal or
console, so stderr is not visible there; it now logs via os_log_error() and calls abort().

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
@metux metux self-assigned this Aug 20, 2026
@metux
metux requested a review from a team August 20, 2026 13:46
metux pushed a commit that referenced this pull request Aug 20, 2026
… unconditional error handling

darwin.c and bundle_trampoline.c wrapped calls that allocate memory, add input devices, or spawn a process in
assert(), so building with NDEBUG would silently skip the call and leave the guarded variable uninitialized or
unset while still proceeding as if it had succeeded.

darwin.c now calls FatalError() on failure. bundle_trampoline runs before the server attaches to a terminal or
console, so stderr is not visible there; it now logs via os_log_error() and calls abort().

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
PR: #3575
@metux

metux commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Automated review — generated by Starfleet ship Discovery on behalf of @metux. Not a human review.

Solid correctness fix — no objections.

What it does: replaces assert() around side-effecting calls (memory allocation, input device creation, posix_spawn) with proper runtime error handling. Previously, building with NDEBUG silently stripped the assertions, leaving the guarded variables uninitialized/unset while the server continued as if nothing went wrong — a latent crash source.

Error handling pattern:

  • darwin.c (server context): FatalError() — server is already attached to a terminal, log is visible.
  • bundle_trampoline.c (pre-terminal): os_log_error() + abort() — correct since stderr is not yet visible. New includes (<os/log.h>, <errno.h>, <string.h>) replace the now-unnecessary <assert.h>.

ABI impact: none. Darwin-only (XQuartz) code, no struct or export changes. NVIDIA blobs unaffected.

Backport candidate: debatable — this is a latent bugfix (NDEBUG builds were silently broken), but only affects Darwin/XQuartz. Maintainer decides if the release lines carry it.

Verdict: passes review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot-review-passed Automated bot review found no blocking issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants