Skip to content

fix: X11 forwarding entrypoint; allow empty rolling_tag in macos workflow - #10

Merged
aanas-sayed merged 4 commits into
mainfrom
fix/x11-forwarding-prime-display
May 9, 2026
Merged

fix: X11 forwarding entrypoint; allow empty rolling_tag in macos workflow#10
aanas-sayed merged 4 commits into
mainfrom
fix/x11-forwarding-prime-display

Conversation

@aanas-sayed

@aanas-sayed aanas-sayed commented May 9, 2026

Copy link
Copy Markdown
Owner

Summary

Two unrelated-but-small changes bundled into one PR.

1. X11 forwarding entrypoint fix

Two bugs surfaced when running with -e DISPLAY=host.docker.internal:0 (XQuartz on macOS):

  • The entrypoint was taking the caller's \$DISPLAY and trying to start Xvfb on it. Xvfb only binds local display numbers, so it failed immediately — source of the ERROR: Xvfb exited unexpectedly! line on every X11-forwarded run.
  • The Wine priming step inherited that same caller-supplied DISPLAY, so Wine's first-run service init talked to the real host X server in a half-initialised state. That's why the first ltspice invocation in the resulting shell failed and only the second succeeded.

Fix:

  • Pin the prime step to DISPLAY=:99 (Xvfb isn't running yet → connection fails fast → Wine init completes cleanly).
  • After priming, branch on caller-supplied DISPLAY: use it as-is and skip Xvfb when present; otherwise start the private Xvfb on :99 as before.
  • Drop the now-stale "first-run Xvfb failure" workaround note from README.

2. macos-latest workflow: optional rolling tag

Publish macos-latest (Wine 9) now accepts an empty rolling_tag input. Default stays macos-latest so existing behavior is unchanged; setting the input to an empty string publishes only the immutable devel-YYYYMMDD-wine-X.Y tag and leaves macos-latest pointing at whatever it was before. Useful for trial builds that should not move the rolling pointer.

Test plan

  • Headless test.sh (no caller DISPLAY) — Xvfb path unchanged, CI green
  • macOS XQuartz: docker run -it -e DISPLAY=host.docker.internal:0 -v /tmp/.X11-unix:/tmp/.X11-unix aanas0sayed/docker-ltspice:macos-latest — no Xvfb error in entrypoint output, ltspice opens GUI on first invocation
  • Trigger workflow with empty rolling_tag — confirm only the dated devel tag appears on Docker Hub
  • Trigger workflow with default rolling_tag — confirm both tags appear (regression check)

Two bugs in the X11-forwarding path:

- The entrypoint took the caller's $DISPLAY (e.g. host.docker.internal:0
  for XQuartz) and tried to start Xvfb on it. Xvfb only binds local
  display numbers, so it failed immediately and the loop printed
  "ERROR: Xvfb exited unexpectedly!" on every X11-forwarded run.

- The Wine priming step ran with that same caller-supplied DISPLAY,
  meaning Wine's first-run service init talked to the real host X
  server in a half-initialised state — exactly the case the comment
  in the file warned against ("services try to create windows and
  block forever"). The visible symptom: the first `ltspice` invocation
  in the resulting shell failed and only the second succeeded.

Pin the prime step to DISPLAY=:99 (Xvfb hasn't started yet, so the
connection fails fast and Wine init completes cleanly). Then branch:
if the caller supplied DISPLAY, use it as-is and skip Xvfb entirely;
otherwise start the private Xvfb on :99 as before.

Drops the now-stale "first-run Xvfb failure" note from README; the
underlying race is gone.
Default stays "macos-latest" so existing behavior is unchanged. Setting
rolling_tag to an empty string in the workflow_dispatch form now skips
the rolling pointer push and only publishes the immutable
devel-YYYYMMDD-wine-X.Y tag — useful for trial builds that should not
move macos-latest.
@aanas-sayed aanas-sayed changed the title fix: skip Xvfb when caller provides DISPLAY (X11 forwarding) fix: X11 forwarding entrypoint; allow empty rolling_tag in macos workflow May 9, 2026
The previous commit's entrypoint logic checked
  USER_DISPLAY="${DISPLAY:-}"
  if [ -n "$USER_DISPLAY" ]; then ... skip Xvfb ...
to decide whether the caller had set DISPLAY (X11 forwarding) or not.

But the Dockerfile baked DISPLAY=:99 into ENV, so $DISPLAY was
*always* non-empty inside the container even when the caller passed
nothing. The entrypoint mistook the image default for a caller value
and skipped Xvfb on every run — Wine then had no X server to talk to
and the simulation produced a perm-denied / no-log failure (visible
in the macos-latest workflow run as "Using caller-provided
DISPLAY=:99 (skipping Xvfb)").

Drop DISPLAY from ENV; set it inline only on the build-time wine
commands that actually need it. Now an unset DISPLAY at runtime
correctly means "headless, start Xvfb."
GitHub's workflow_dispatch UI substitutes the configured default back
in when a string field is left blank, so the previous "leave
rolling_tag empty to skip" mechanism never actually skipped — every
run still pushed macos-latest. Replace with a publish_rolling boolean
input (defaults to true so the common case is unchanged); rolling_tag
is only consulted when the toggle is true.
@aanas-sayed
aanas-sayed merged commit 71d6530 into main May 9, 2026
11 checks passed
@aanas-sayed
aanas-sayed deleted the fix/x11-forwarding-prime-display branch May 9, 2026 23:58
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