Skip to content

fix(cli): keep the display server and stray stderr off the dashboard - #359

Merged
samsoir merged 2 commits into
develop/0.5.1from
fix/display-stderr-358
Nov 11, 2026
Merged

samsoir merged 2 commits into
develop/0.5.1from
fix/display-stderr-358

Conversation

@samsoir

@samsoir samsoir commented Nov 11, 2026

Copy link
Copy Markdown
Owner

Closes #358

Fix

  • system::disown_display() removes DISPLAY and WAYLAND_DISPLAY from the process environment, called from main before any thread exists. XEarthLayer never presents to a display and chooses its adapter from texture.gpu_device, so the display's answer was never used. With no display named, Mesa's device-select layer and the NVIDIA ICD have nothing to connect to, and enumeration is spared the round trips.
  • StderrDetour points fd 2 at the flight log (appended, as tracing's appender is) or /dev/null for the dashboard's lifetime, and puts the terminal back when it drops unless SIGHUP already took it. Anything in C that writes to stderr, and a panic message, now lands in the log rather than on the screen.

Verification

  • Five new tests, each red first: the display variables are removed; stderr reaches the sink; the sink is appended, not truncated; the original stderr returns on drop (device and inode compared); an unopenable sink leaves stderr untouched.
  • make pre-commit green (2669 library tests, 594 CLI tests, clippy clean).
  • Release binary under the reproducing environment, env -u XAUTHORITY DISPLAY=:0: diagnostics prints "Authorization required, but no authorization protocol specified" 0 times (3 before) and lists the same two adapters (RTX 5090, RADV).
  • xearthlayer run launched from the tmux shell: dashboard clean.

In a shell with DISPLAY set but no usable XAUTHORITY, `xearthlayer run`
printed "Authorization required, but no authorization protocol specified"
at launch and the line bled into the dashboard; `diagnostics` printed it
three times under GPU Compute Adapters. The text is the X server's refusal
reason, written by libxcb with a raw write(2) on fd 2, past tracing and
ratatui. #255 removed the GL probe; the connections now come from Mesa's
VK_LAYER_MESA_device_select (two) and the NVIDIA ICD (one) inside
vkCreateInstance, whatever backends wgpu asks for.

Two changes:

- `system::disown_display()` removes DISPLAY and WAYLAND_DISPLAY from the
  process environment, called from `main` before any thread exists. XEL
  never presents to a display and chooses its adapter from
  `texture.gpu_device`, so the display's answer was never used. With no
  display named there is nothing to connect to, and enumeration is spared
  the round trips. Both adapters still enumerate.

- `StderrDetour` points fd 2 at the flight log (appended, as tracing's
  appender is, so the two writers interleave by line) or /dev/null for
  the dashboard's lifetime, and puts the terminal back when it drops,
  unless SIGHUP already took it. This closes the class: anything in C that
  writes to stderr, and a panic message, lands in the log rather than on
  the screen or lost with the alternate screen.

Verified with the release binary under `env -u XAUTHORITY DISPLAY=:0`:
`diagnostics` prints the line 0 times (3 before) and lists the same two
adapters.
@samsoir
samsoir merged commit f6b7d31 into develop/0.5.1 Nov 11, 2026
2 checks passed
@samsoir
samsoir deleted the fix/display-stderr-358 branch November 11, 2026 05:12
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