Skip to content

term: clamp zero window size from Docker PTY#964

Open
tomholford wants to merge 1 commit intourbit:developfrom
tomholford:th/i/159/fix-docker-tty-zero-winsize
Open

term: clamp zero window size from Docker PTY#964
tomholford wants to merge 1 commit intourbit:developfrom
tomholford:th/i/159/fix-docker-tty-zero-winsize

Conversation

@tomholford
Copy link
Contributor

Summary

  • When Docker allocates a PTY (tty: true + stdin_open: true) but nobody is attached, TIOCGWINSZ succeeds but reports 0x0
  • This causes a decrement-underflow crash in drum when it receives %blew [0 0]
  • Clamp to 80x24 defaults when ioctl returns zero dimensions (matching existing fallback when ioctl fails)

This is a v2 of #959, which was merged then reverted due to a regression. The prior version also changed the initial row_l from 0 to 24, which broke terminal output on macOS — row_l = 0 is a sentinel used by hija/loja and the spinner to skip cursor positioning during early boot. Setting it to 24 caused every u3l_log() call before the first %blew event to reposition the cursor, producing blank lines. This version keeps row_l = 0 and only adds the clamping in u3_term_get_blew.

Resolves #159.
See also urbit/urbit#4750

Test results

Docker on x86_64 Linux VPS (Ubuntu, tty: true + stdin_open: true, no attach):

  • Cross-compiled for x86_64-linux-musl, built Docker image, transferred to VPS
  • Fresh comet booted successfully, ran 8+ minutes with no crash
  • Container config matches the exact scenario that triggers the bug

macOS aarch64 (native build, PTY via script):

  • Fresh comet booted, full bootstrap completed
  • No spurious blank lines in boot output (the regression from term: clamp zero window size from Docker PTY #959 is fixed)
  • Early boot log lines use plain text (no cursor positioning), confirming row_l = 0 sentinel works correctly

When Docker allocates a PTY (tty: true + stdin_open: true) but nobody
is attached, TIOCGWINSZ succeeds but reports 0x0. This causes a
decrement-underflow crash in drum when it receives %blew [0 0].

Clamp to 80x24 defaults when ioctl returns zero dimensions, matching
the existing fallback when ioctl fails entirely.

Unlike the prior attempt (urbit#959), this does not change the initial
row_l from 0 — that value serves as a sentinel throughout term.c
to skip cursor positioning during early boot (checked by hija/loja
and the spinner). Changing it to 24 caused blank lines in terminal
output on macOS.

Resolves urbit#159.
@tomholford tomholford requested a review from a team as a code owner February 18, 2026 21:39
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.

Docker: tloncorp/vere bails during launch

1 participant