Skip to content

Merge develop into next/kelvin/408#994

Merged
pkova merged 23 commits into
next/kelvin/408from
develop
Apr 2, 2026
Merged

Merge develop into next/kelvin/408#994
pkova merged 23 commits into
next/kelvin/408from
develop

Conversation

@pkova
Copy link
Copy Markdown
Collaborator

@pkova pkova commented Apr 1, 2026

No description provided.

mikolajpp and others added 23 commits October 10, 2025 14:13
Conn protocol closes the channel as soon as an EOF is received
from a read request. This is at odds with a typical usage of conn,
where separate programs are used to send a command and receive a result.

We modify this behavior by calling moat `bal_f` only on genuine read errors.
Furthermore, in conn.c we close the channel after processing the effect
if we detect that the read end of the pipe has closed.
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 (#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 #159.
Updates wasm3 dependency after urbit/wasm3#2 and
adds additional stashing of global variables in case of reentrance.
Previously only pointers to the arenas were stashed but not the
allocating functions, which could have caused more `bail:fail`s than it
had to.
Includes and supersedes #892, ensuring no behavior change for mars/urth
IPC pipe.
`"... keyfile,resume ..."` -> `"... keyfile, resume ..."`
## 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](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 #959 is
fixed)
- Early boot log lines use plain text (no cursor positioning),
confirming `row_l = 0` sentinel works correctly
We were using gag_u->try_w to track retry counts for determining whether to
update rtt and rtt since my PR in #977. This is obviously bogus since we only
have one gage per peer but can have multiple flows outstanding per peer. Here we
switch to tracking retry counts with tie_y in u3_pact_stat which is per flow,
making sure to guard against the overflow.
Working around a clang bug that causes the frame pointer to be corrupt after longjmp.
During discussion at llvm/llvm-project#188494
it was pointed out to me that instead of trying to use
`__builtin_setjmp` I should just change the calling convention for our
setjmp.

Tested on Windows with `ReleaseFast` build, Arvo tests ran fine.
@pkova pkova requested a review from a team as a code owner April 1, 2026 16:47
@pkova pkova merged commit faff152 into next/kelvin/408 Apr 2, 2026
5 checks passed
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.

6 participants